• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Simple Joda DateTime Question

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

I am creating a Joda DateTime object as follows...



I am seeing that the value of dt1 in my debugger is "2013-10-07T00:00:00.000-04:00". So I am just wondering what this "T00:00:00.000-04:00" means? I am guessing it is the time representation of my date but what time is it?

Thanks.
 
Sheriff
Posts: 22563
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The value you're seeing is similar to the ISO-8601 formatting. This dictates that the date is first formatted in yyyy-MM-dd format, followed by a literal T, followed by the time and the time zone. So for your date:
  • 2013-10-07 is the date (October 7th).
  • T is the required literal.
  • 00:00:00.000 is the time with millisecond precision (midnight).
  • -04:00 is the timezone offset from UTC (4 hours before UTC).

  •  
    Java Cowboy
    Posts: 16084
    88
    Android Scala IntelliJ IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The Joda Time library has a number of different classes for dates and times.

    DateTime is a timestamp that contains a date and a time, in a certain timezone.

    If you just want a date (without a time), use LocalDate instead of DateTime.
     
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic