Page 1 of 1

how to get current time from device?

Posted: Fri May 22, 2015 4:43 pm
by Michael Droll

I need to add a time stamp to my app for local storage.

what are the API for date and time from the device? Date and time need to be separate storage variables.
I also need to be able to get the date and time when used from a desktop browser as well as when used on a mobile device.

I tried to google it but couldn't find anything that explained it in a way I could understand. This is probable what i need to know but I dont understand how t use it: http://docs.phonegap.com/en/edge/cord...

Thank you in advance!


how to get current time from device?

Posted: Fri May 22, 2015 8:28 pm
by Serhii Kulibaba

Hello Michael,

You can get current timestamp via code below:

var timestamp = (new Date()).getTime();


how to get current time from device?

Posted: Wed May 27, 2015 8:19 pm
by Michael Droll

Thank you that worked perfectly!