aspose file tools*
The moose likes Other Open Source Projects and the fly likes Simple Joda DateTime Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Simple Joda DateTime Question" Watch "Simple Joda DateTime Question" New topic
Author

Simple Joda DateTime Question

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
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

Joined: Oct 27, 2005
Posts: 19693
    
  20

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).


  • SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
    How To Ask Questions How To Answer Questions
    Jesper de Jong
    Java Cowboy
    Saloon Keeper

    Joined: Aug 16, 2005
    Posts: 14146
        
      18

    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.


    Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
    Scala Notes - My blog about Scala
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Simple Joda DateTime Question