• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple Joda DateTime Question

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Spoor
Sheriff
Pie
Posts: 20368
43
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • 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).

  •  
    Jesper de Jong
    Java Cowboy
    Saloon Keeper
    Pie
    Posts: 15150
    31
    Android IntelliJ IDE Java Scala Spring
    • 0
    • Mark post as helpful
    • send pies
    • 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.
     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic