Convert wrong Android timestamp on Php date() function -


i getting timestamp (1370956788472) of android message :

       cursor.getstring(cursor.getcolumnindex("date")) 

and trying convert android timestamp using php date() function , getting wrong date , time

echo date('y-m-d h:i:s','1370956788472');    output : 1997-04-28 09:50:48 

but display correct date , time if remove last 3 character timestamp (removed 472 1370956788472) :

echo date('y-m-d h:i:s','1370956788');     output: 2013-06-11 13:19:48 

what wrong here , should can divide android timestamp 1000

this time format 1370956788472 (the longer) in milliseconds.

the shorter 1 1370956788 in seconds, can type time $time = time() in php.

so divide 1000.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -