wimbarelds / TimeCircles

jQuery plugin to show time since or time until a specific time
295 stars 149 forks source link

Time server-side #82

Open henkjanklok opened 10 years ago

henkjanklok commented 10 years ago

Hi, i have an question. I use Time Circles for an online auction. I will use the time from the server. By default use TimeCircles use the local machine time. It is possible to change the time to server time (PHP)? Do you have an example? Thanks! (sorry for bad english)

wimbarelds commented 10 years ago

Hi there, you can use a Date String that includes a locale, however for this TimeCircles uses the browser's built in DateTime string formats. The most common are: RFC2822 or ISO 8601. Both of these formats should work and you should be able to generate them using PHP.

In fact, if you have a unix timestamp you can output it as an RFC 2822 DateTime string using:

date("r", $unixtime);

The overall code might look something like:

<div id="CountDown" data-date="<?=date('r', $unixtime)?>"></div>