June 4, 2013

Best method to get double value from datetime in jquery

User2451211’s Question:

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

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

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!