aspose file tools*
The moose likes Beginning Java and the fly likes Java time & date API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java time & date API " Watch "Java time & date API " New topic
Author

Java time & date API

shikhi sharma
Greenhorn

Joined: Jul 20, 2009
Posts: 1
Hi,



I get started = "2009-07-20T11:04:02-07:00" time string from the server. I know the current device location is Newyork (lon="-73.805687" lat="40.682949"). The way C# code handles it is,



DateTime Started = Convert.ToDateTime(Reader["Started"]);


if(Reader["TimeZoneOffset"] != DBNull.Value)
{
TimeZoneOffset = Convert.ToInt32(Reader["TimeZoneOffset"]);
Started=Started.AddHours(TimeZoneOffset);
}

And, i display Started : 7/20/2009 2:04 PM



How can this same thing be done in JAVA? Please help!!



-Shikha




K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2584
    
    9

Welcome to the ranch.

Try looking at the java.text.SimpleDateFormat class.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java time & date API