FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


DST using Date("I")?





Aredon
Hello everyone! I recently tried to create an easy way to change the timestamps on my website to DST if and when DST was active.
Code:
function DSTamp($timestamp){
include_once 'settings.php';
$dst = date("I");
$timezone= 8 - $dst;
return gmdate("m/d/Y @ h:i:sa",$timestamp-($timezone*3600)-$tfix)." (PST)";
}

I did this because DST is not active on frihost servers and I wanted to see if I could get it to work with the date function where gmdate would likely ignore it, but as DST came and went... the time did not change Sad

The code is admitadely, a little sloppy, but I was curious if anyone knew:
1.) Why this might not be working correctly.
2.) Another work around for automated DST without it being declared on the server.
3.) A really easy way to make this work that makes me look like an idiot for not thinking of it. (you know you want to Smile)
kv
http://php.net/mktime

http://php.net/date_default_timezone_set
Aredon
kv wrote:
http://php.net/mktime

http://php.net/date_default_timezone_set

Awesome! Thank you very much; I'd looked all over for a function to do just that. I must have skipped over it Embarassed.
Related topics
Help with mysql query
What date format do you prefere with MySQL?
SQL QUERY for yesterday's Record
FTP - file last modified date
PHP date() format for atom in php 4
What is the best way to save a date/timestamp in mysql
wrong date using time() and date()
date() problem
footer.php date wrong
Pa. Teacher Resigns After Porn Star Date
displaing the date
Government using Singaporean Pension Fund as if theirs.
Date/Time Entries (PHP & MySQL)
Date within a Timeframe
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.