Page 1 of 1

wrong database item time

Posted: Mon Jun 16, 2014 1:32 am
by Kurt6863778

hey my database items list the wrong time that i add or update a record in database when i list the created at or updated at time . when i first used this feature it worked and actually matched my time on computer/pone but now it is 4 ours ahead of my time (Barbados) and i have not changed any time preferences here on my pone nor laptop .

or

is there a way i can just display the date only wen the item was added to database ? thanks


wrong database item time

Posted: Mon Jun 16, 2014 3:00 am
by Yurii Orishchuk

Hi Kurt.

Appery.io using GMT as base time. See about GMT: http://en.wikipedia.org/wiki/Greenwic...

So, if you need you can convert this time to other one.

For example you can use following code to do it:

pre

var gmtDate = new Date("2014-04-15 00:32:22.883");

//Here is time zone offset you need to set it in accordace with your location.
var timeOffset = 2;
var localDate = new Date(gmtDate.getTime() + timeOffset * 3600 * 1000);

var dateString = localDate.getDate() + "-" + (localDate.getMonth() + 1) + "-" + localDate.getFullYear() + " " + localDate.getHours() + ":" + localDate.getMinutes();

console.log(dateString);

/pre

Regards.