Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java time & date API

 
shikhi sharma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3521
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch.

Try looking at the java.text.SimpleDateFormat class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic