1

Am working in HTML5 + Phonegap - Android Application. Currently am facing a problem in convert server timestamp to local timestamp

From my server i get Datetime : 2014-02-07 00:01:15 and Timestamp : America/New_York

I want to convert the given time to my device Timestamp.

I got an another Question same like my requirement Convert date to another timezone in JavaScript and I tried this but its failed! I got this error in Eclipse enter image description here

I think its a small issue but didnt get a solution for this !! Please help me..

or anyone can suggest any other method for the same?? :(

Community
  • 1
  • 1
ULLAS MOHAN.V
  • 1,521
  • 1
  • 19
  • 36
  • Are you using the [Globalization API](https://github.com/apache/cordova-plugin-globalization/blob/dev/doc/index.md)? You could use that to get the device's timezone and just convert using the Date object. – Andrew Lively Mar 05 '14 at 16:04
  • 1
    Even though you accepted an answer already, i would suggest that a nice way to work this stuff out is by using milliseconds since the Unix epoch: Java: System.currentTimeMillis() Javascript: new Date().getTime(). You can then use GregorianCalendar in Java or new Date(milliseconds) in Javascript to interpret the milliseconds. – Sandman Mar 08 '14 at 14:31

1 Answers1

1

A Javascript library Moment Timezone may help you but you need to use it in combination with moment.js.

Tamura
  • 1,788
  • 1
  • 14
  • 10