Michael Droll
Posts: 0
Joined: Wed Mar 04, 2015 5:05 am

how to get current time from device?

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!

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

how to get current time from device?

Hello Michael,

You can get current timestamp via code below:

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

Michael Droll
Posts: 0
Joined: Wed Mar 04, 2015 5:05 am

how to get current time from device?

Thank you that worked perfectly!

Return to “Issues”