galdikas Posted June 30, 2011 Share Posted June 30, 2011 ok I know how to set default timezone... But how to set the daylight saving???? So it automatically switches the times... And from given timestamp shows the correct time (even for lets say 7 months old timestamp) Found some functions on web.. But none seem to work properly.. Any advice on this? Or is it even important to have a correct DST?? Never thought how complicated timekeeping is till got into this programming thing :) Remember once on discovery saw this guy that was a timekeeper for a living... Gee I thought wtf is timekeeper for.... Just buy a clock lol Well I take my words back now :D Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted June 30, 2011 Share Posted June 30, 2011 if your own xampp it should automatically do it if your using an online host provider not sure if its possible unless you make a function to add/subtract seconds if it is the time of year of daylight settings Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted June 30, 2011 Share Posted June 30, 2011 To change default time zone, you can either change the time zone in your WHM (thats if you own your own server), or you can use the following php function: date_default_timezone_set (); If you want, London time for example, date_default_timezone_set ('Europe/London' ); About the daylight saving, you would have to do something like this: $hour = date("h", time()); if ($v3 < 12) { echo "Its morning"; ) ^^ That would tell you whether its morning/night ect. I havent tested it, so it may not work however thats the kind of script you would have to use. Quote Link to comment Share on other sites More sharing options...
galdikas Posted June 30, 2011 Author Share Posted June 30, 2011 Well yeah xampp would show my windows time, wouldnt it?... Microsoft obviously figured out how o deal with DST :D Quote Link to comment Share on other sites More sharing options...
galdikas Posted June 30, 2011 Author Share Posted June 30, 2011 Kieran, thank you so much! I feel a bit silly now :) I had it like that date_default_timezone_set ('GMT' ); Now that I have changed it to: date_default_timezone_set ('Europe/London' ); It displays correct time :) Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted June 30, 2011 Share Posted June 30, 2011 Kieran, thank you so much! I feel a bit silly now :) I had it like that date_default_timezone_set ('GMT' ); Now that I have changed it to: date_default_timezone_set ('Europe/London' ); It displays correct time :) No problem. Glad I could help. Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted June 30, 2011 Share Posted June 30, 2011 i thought you were having a problem automatically getting daylight savings time or was it just because you an incorrect parameter? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.