2

Which is the best way to convert datetime to double in jquery? I have used Date.parse. But, it is not correct in few cases. Also,i am unable to pass datetime format for that method.

- Viji

  • The best way is to convert the datetime to unixtime.. And how do you do it? See this... http://stackoverflow.com/questions/11509814/date-string-conversion-to-unix-timestamp-in-javascript-jquery – writeToBhuwan Jun 04 '13 at 10:06

1 Answers1

0

In JavaScript, you can simple do variablename.toFixed(2); for that.

Example:

var num1 = 12312.12312
console.log(num1.toFixed(2)); // Will give 12312.12
Starx
  • 77,474
  • 47
  • 185
  • 261