Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

LocalDateTime not worked with DateTimeFormatter.ISO_OFFSET_DATE_TIME as ZonedDateTime did

Ranch Hand
Posts: 84
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mr. Hanumant Deshmukh ,

Note: ZonedDateTime not included for OCA Exam. I just mention to compare with LocalDateTime.

I found there is a difference in working with ZonedDateTime and LocalDateTime.

LocalDateTime doesn't support DateTimeFormatter.ISO_OFFSET_DATE_TIME, but ZonedLocalDateTime does.

Here is the code:

Output is produced as follows:

What does it mean the 'OffsetSeconds' in error section?

Thank you

Posts: 69782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check the documentation for ISO_OFFSET_DATE_TIME. Maybe it requires a time object with a field representing the offset between GMT/UTC and the local time zone in seconds. You should be able to find that from the local and zone date time documentation, or there might be something in the Java™ Tutorials. About halfway down that tutorials section there is a page about time zones.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic