Daguse Posted August 15, 2008 Share Posted August 15, 2008 Thanks to unkwntech I found that Date(I); will tell me if the date is daylight saving time or not. 1 if is, 0 if not. However we are in DLS and I am getting a 0. Any Date(I, mktime(any date)); I get 0. even just Echoing Date(I); I get 0. Is there a reason for this? To give the full pic here, I am trying to make an SQL input with the current date and time. However when DLS comes and goes it changes my input by an hour. Code below. //date time stamp with local time. $DLS = date(I); if ($DLS > 0) { $tz = -4; } else { $tz = -5; } $timezone= $tz; $time=time(); $gmttime= gmdate("M d Y H:i:s", $time); $sqldate=date("Y-m-d H:i:s",strtotime("$timezone hours",strtotime($gmttime))); Thanks all for helping a basic newbie. Link to comment https://forums.phpfreaks.com/topic/119769-datei-problem/ Share on other sites More sharing options...
kenrbnsn Posted August 15, 2008 Share Posted August 15, 2008 Arguments to the date() function should be strings. Try: <?php $tz = date('I'); ?> Ken Link to comment https://forums.phpfreaks.com/topic/119769-datei-problem/#findComment-617047 Share on other sites More sharing options...
Daguse Posted August 15, 2008 Author Share Posted August 15, 2008 sorry, I see now I posted old code. I use date('I'); still does not work. //date time stamp with local time. $DLS = date('I'); if ($DLS > 0) { $tz = -4; } else { $tz = -5; } $timezone= $tz; $time=time(); $gmttime= gmdate("M d Y H:i:s", $time); $sqldate=date("Y-m-d H:i:s",strtotime("$timezone hours",strtotime($gmttime))); Link to comment https://forums.phpfreaks.com/topic/119769-datei-problem/#findComment-617055 Share on other sites More sharing options...
Daguse Posted August 15, 2008 Author Share Posted August 15, 2008 any one else got some pointers. Link to comment https://forums.phpfreaks.com/topic/119769-datei-problem/#findComment-617359 Share on other sites More sharing options...
JasonLewis Posted August 15, 2008 Share Posted August 15, 2008 Correct me if I'm wrong anyone, but... Where is your server? That would be returning if it was daylight savings where your server is. Link to comment https://forums.phpfreaks.com/topic/119769-datei-problem/#findComment-617362 Share on other sites More sharing options...
Daguse Posted August 15, 2008 Author Share Posted August 15, 2008 NJ in Clifton. They do run DLS. Link to comment https://forums.phpfreaks.com/topic/119769-datei-problem/#findComment-617702 Share on other sites More sharing options...
Daguse Posted August 16, 2008 Author Share Posted August 16, 2008 Ok well is there perhaps another way I could do this? Link to comment https://forums.phpfreaks.com/topic/119769-datei-problem/#findComment-618054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.