Jump to content

Recommended Posts

 

Hello,

I have been stuck in this issue for 3 days now, I have datetime records in a mysql table, I need a php clock which naturally counts down, I mean acts like a clock, but the clock time should be the datetime field value descending by the second, based on the full datetime, from year to seconds

 

It is not just one record, I made it to display this clock, the problem is javascript, which makes all the 36 records the last record value, it is an ajax pagination, so i will need to do the same on  second page, right now ajax is not a prioritty, I can let go of ajax pagination, but need to display the clock

 

Help is appreciated

 

Many Thanks

Can you tell me how to convert php timestamp to javascript new date()

 

Second result on Google

 

Syntax

new Date()
new Date(milliseconds)
new Date(dateString)
new Date(year, month, day [, hour, minute, second, millisecond])

 

So, as you can see, Date() will accept milliseconds. A UNIX timestamp is in seconds. So, multiply UNIX timestamp by 1000 and you have your milliseconds.

 

<?php

echo '<script>var date = new Date(1346359165 * 1000);</script>';

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.