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

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

Java - Returning an array from a method to main -