Millisecond

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

I don't know much of JavaScript but I can be done. Since the time is taken from January 1st, 1970 and is counted in seconds then you just do the internal math to figure out how many milliseconds that is. 1000 milliseconds equals a second. So take the current second count and just multiply it by 1000 for the number of milliseconds since 1970.

I don't understand how you could convert the current time into milliseconds. You have to find out from what time to what time = x number of milliseconds.

VulKen
Just babblin'

Pimpin like a pimp with an electrofied pimpin machine!

They have: 39 posts

Joined: Jun 2000

Is it possible in JavaScript to get millisecond for current data and time i.e. is it possible to convert current date amd time into milliseconds?

Thanks!

They have: 231 posts

Joined: Feb 2000

There is a method of the Date object that returns a date as a millisecond representation since Jan 1 1970. It is the 'parse()' method. This is handy when comparing 2 dates.

var currentDateObj = new Date;
var currentDateMilliseconds = Date.parse(currentDateObj)

:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::

They have: 39 posts

Joined: Jun 2000

Yes, you are right, I did same thing yesterday

var num2 = new Date();
var number_id = num2.getTime();

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.