I use this code to find time difference,
alert(( new Date("1970-1-1 12:42 ") - new Date("1970-1-1 9:42") ) / 1000 / 60 / 60 );
it works in chrome, but in firefox it shows NaN error.
How to solve this?
I use this code to find time difference,
alert(( new Date("1970-1-1 12:42 ") - new Date("1970-1-1 9:42") ) / 1000 / 60 / 60 );
it works in chrome, but in firefox it shows NaN error.
How to solve this?
You have to format the date string to something that Date()
can handle, follow:
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.