Jump to content

[SOLVED] strtotime


richiec

Recommended Posts

http://fearedwarlords.dks-gfx.com/timeframe/index.php

 

If you go there you will see that there are some color images and some grayed out versions of the images.. Now if you hover over the color image you will see that it has a time and date.

 

what i want to do is if the time and date is before what it has on the hover over, for it to display the gray image.. if it is after the time and date on there for it to display the color image.

 

Now i have that working ( i think ) with this

 


if(strtotime('now') > strtotime($date $time)) {
      echo "<a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> 
<img src=\"$image\" />"; 

} else {
      echo "<img src='$image2'>";

 

But that uses unix time, and i need it set to work from a different time zone, does anyone know how i can change that to work from the time zone that i want.

 

Thanks

 

Rich.

Link to comment
https://forums.phpfreaks.com/topic/59947-solved-strtotime/
Share on other sites

putenv("TZ=Europe/London"); // Put this at the top of your code

 

List of timezones: http://www.php.net/manual/en/timezones.php

 

ok with that done i now get an unexpected T_VARIABLE error on this line

 

if(strtotime('now') > strtotime($date $time)) {

 

full part of it with your code is

 

putenv("TZ=America/New_York"); // Put this at the top of your code

// if(strtotime('now') > strtotime("$mysql_date $mysql_time")) {
if(strtotime('now') > strtotime($date $time)) {
      echo "<a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> 
<img src=\"$image\" />"; 

} else {
      echo "<img src='$image2'>";
}

 

any ideas what i did wrong?

 

 

that page works fine, but you need to be loged in first, once the index.php page is finished it will need to be loged in also to view.. i have just taken that off this page for now untill i get it working right so i can use it as an example to show people what im trying to do.

Link to comment
https://forums.phpfreaks.com/topic/59947-solved-strtotime/#findComment-298205
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.