JavaScript: Round timestamp by 3 seconds

alert( Math.ceil(new Date().getTime()/1000) );

Open in new window

This returns a timestamp, to the second.  I want it rounded up to the closest 3 seconds.  It should remain the same for 3 seconds then jump up 3 more seconds.
LVL 16
hankknightAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
alert( Math.ceil(new Date().getTime()/3000)*3 );
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.