ruby - Parse ticks to datetime -


how can convert tick, such 1298011537289 datetime in ruby?

the value need convert coming javascript date.now() call, it's in milliseconds

per ruby docs:

mytime = time.at(1298011537289) 

or since you're using milliseconds rather seconds:

mytime = time.at(1298011537289 / 1000) 

but remove sub-second precision, retain it:

mytime = time.at(rational(1298011537289, 1000)) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -