I have a millisecond timestamp that I need to convert from a String to long. Javascript has a parseInt
but not a parseLong
. So how can I do this?
JavaScript has a Number
type which is a 64 bit floating point number*.
If you're looking to convert a string to a number, use
parseInt
, I'd recommend always passing the radix too.+
operator e.g. +"123456"
Number
constructor e.g. var n = Number("12343")
*there are situations where the number will internally be held as an integer.
It's because there is no long
in javascript.
http://javascript.about.com/od/reference/g/rlong.htm