Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You may create function DisplayDate($datetoconvert) for your script to convert time to your time - and to return new time.</p> <pre><code>DisplayDate($xtime) //assuming its a unix timestamp.. { $mydifferece = 6; // hours $newtime = $xtime+($mydifference*3600); // $newtime = date("d-m-Y H:i:s", $newtime); return $newtime; } </code></pre> <p>//html</p> <p>Written by: '.DisplayDate($timewritten).';</p> <p><strong>Function time for all users..</strong> </p> <ul> <li>"session" table should now have "timezone" column - for users to enter their timezone, varchar(3) default nothing</li> <li>and we should have "select" options with timezones!</li> </ul> <p>//lets display actual time to users..</p> <pre><code>//$xtime is database entry to be converted (if any) //$usertimezone is a selected timezone by user, driven from session (guests) - or users table.. (ie +6, or -7, or +1 and so on..) DisplayDate($xtime="",$usertimezone="") { if(!$xtime) //given time (to be converted) dont exists, okay - lets give some right now time.. { $xtime = time(); //set time to "right now", unix timestamp } //now we have time, lets see if user selected his timezone.. if($usertimezone != "") //someone selected his timezone, time to do the job.. { //herein (additionally) we should add support for winter and summer time (daylight) - if that zone support that changes.. but im leaving that empty for now.. $xtime = $xtime+($usertimezone*3600); //difference * seconds per hour } else { //usertimezone not set, user dont care about his time to be displayed correctly, or its just a bot or spider, so do nothing.. } $xtime = date("j. m, Y. H:i:s", $xtime); //lets just do some cosmetics.. return $xtime; } </code></pre> <p>// HTML</p> <p>//from database - ie for displaying comments, or articles datecreated times..</p> <pre><code>echo DisplayDate($comment['commentdate'],$session['usertimezone']); </code></pre> <p>//to display clock lets say..</p> <pre><code>echo DisplayDate('',$session['usertimezone']); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload