DateAndTime>>fromJavaScriptTime:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DateAndTime>>fromJavaScriptTime:

sebastianconcept@gmail.co
Hi guys,

When you have a JavaScript date number like:
new Date(1412279266711)

for

Thu Oct 02 2014 16:47:46 GMT-0300 (BRT)

It would be really great to be able to do in Pharo something like:

DateAndTime fromJavaScriptTime: 1412279266711

Do we have something that can do that?



Reply | Threaded
Open this post in threaded view
|

Re: DateAndTime>>fromJavaScriptTime:

Martin Bähr
Excerpts from Sebastian Sastre's message of 2015-02-07 18:08:20 +0100:

> When you have a JavaScript date number like:
> new Date(1412279266711)
> for
> Thu Oct 02 2014 16:47:46 GMT-0300 (BRT)
>
> It would be really great to be able to do in Pharo something like:
>
> DateAndTime fromJavaScriptTime: 1412279266711
>
> Do we have something that can do that?

javascript uses unix time in microseconds:

DateAndTime fromUnixTime: 1412279266711 / 1000
"2014-10-03T03:47:46.711+08:00"

greetings, martin.

--
eKita                   -   the online platform for your entire academic life
--
chief engineer                                                       eKita.co
pike programmer      pike.lysator.liu.se    caudium.net     societyserver.org
secretary                                                      beijinglug.org
mentor                                                           fossasia.org
foresight developer  foresightlinux.org                            realss.com
unix sysadmin
Martin Bähr          working in china        http://societyserver.org/mbaehr/