Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Question on format method of DateTimeFormatter

 
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


public String format(TemporalAccessor temporal)
Formats a date-time object using this formatter.
This formats the date-time to a String using the rules of the formatter.

Parameters:
temporal - the temporal object to format, not null
Returns:
the formatted string, not null
Throws:
DateTimeException - if an error occurs during formatting



API says This formats the date-time to a String using the rules of the formatter.Can I know where can I read rules of he formatter and also in what scenarios it throws DateTimeException.Any resources to read will be of great help . I want to improve my confidence of answering date formatting questions.

Thanks,
Veena
 
Marshal
Posts: 27211
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, actually, there's a very large section at the top of the API documentation for DateTimeFormatter which, in great detail, goes into how to build a formatter and what the rules are for each part of the formatter.
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic