-
Curdate()
PHP Code:
$query = "SELECT CURDATE() AS today,
MONTH(CURDATE()) AS month,
YEAR(CURDATE()) AS year;";
$result = db_get($query);
$today = mysql_result($result,0, today);
$today_month = mysql_result($result,0, month);
$today_year = mysql_result($result,0, year);
here is the problem:
I am trying to modify a calender script i found on hotscripts. Because i wanted free MySQL hosting i had to get an account with a host in the UK. Well, the calender script uses the servertime to function, so the time is always 6 hours ahead of where i am (eastern time zone) thus, it changes dates at 6 pm eastern time, instead of midnight like a normal calender:xeye: . Well, to fix this i simply have to subtract 6 hours, here is the script i wrote:
PHP Code:
$hour -= 6; //(assuming i already found the $hour variable earlier)
if($hour < 0){
if($today == 1){
$today_month--;
$today--;
if($today_month < 0){
$today_year--;
}
}else
{
$today--;
}
}
when i do it this way, the calender stops working correctly, i think mainly because the date format that $today must come in is different. I must output $today in this format yyyy-mm-dd:agree: .
according to the code waay up top, i cant change the value of $today that easily since it comes out in the format yyyy-mm-dd so i need a way to get $today out in a diff variable DAY(CURDATE()) AS day will that work?
also when i do change the value of the day, month and year, i need to put it back into the format yyyy-mm-dd as mentioned earier...how can i do this? like this? $today = "$today_year-$today_month-$day";
Thanks
-
nm, i think i got it working,
Thanks anyway