Guest Posted January 11, 2005 Posted January 11, 2005 Hi Everybody I have a New Zealand based web site and it's on a American server , when I receive orders the time and date are always a day behind. (as in the amercian server time) Is there anyway way I can change it to show the correct time and date in New Zealand when the order is placed ??? Thanks to anybody that helps.
pcoghlan Posted January 11, 2005 Posted January 11, 2005 Hi, Not sure if this helps but with VB and AccessVB you simply reference the correct time zone by putting something like Now()+DatePart("h",7) where "h" is hours and 7 is the time difference between the server time and the site time, and Now() is the current time. I am sure it is something similar here tooand that someone will post the exact code for you. Paul Hi Everybody I have a New Zealand based web site and it's on a American server , when I receive orders the time and date are always a day behind. (as in the amercian server time) Is there anyway way I can change it to show the correct time and date in New Zealand when the order is placed ??? Thanks to anybody that helps. <{POST_SNAPBACK}>
pcoghlan Posted January 11, 2005 Posted January 11, 2005 Found this on the web, NOT my code I hasten to add! You create a table and insert an entry for each country with time zone difference. It allows your clients to have custom time per country etc. Paul 1. create table in DBMS or File like this CountryTimeCalculation( Country, TimeDifference, DSTStartDate, DSTEndDate ) Note: TimeDifference is in hour DSTStartDate and DSTEndDate should be NULL if that country is not effected by DST. For example: Thailand, +7, NULL, NULL ** NOTE ** you have update your database for DST once a year. 2. function getCountryTimeStamp( $db, $GMT_timestamp, $country ){ // DB is my object handle all database actions. // Get Data From Database $db->Exec("select * from CountryTimeCalculation where Country='$country' "); // For DST ( Daylight Saving Time) if ( $GMT_timestamp < $DSTEndDate and $GMT_timestamp > $DSTStartDate ) $TimeDifference += 1; return strtotime( sprintf("%s%d hours", ( $TimeDiffence<0?"-":"+") , $TimeDifference); } Hi, Not sure if this helps but with VB and AccessVB you simply reference the correct time zone by putting something like Now()+DatePart("h",7) where "h" is hours and 7 is the time difference between the server time and the site time, and Now() is the current time. I am sure it is something similar here tooand that someone will post the exact code for you. Paul <{POST_SNAPBACK}>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.