Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 688
  • Last Modified:

Timezone script for PHP date

Hi all,

I am in the process of implimenting a timezone feature on my site. The users will have a profile where they can choose their correct timezone.
Im doing this so any dates/ times shown through-out the site are relevant to the user no matter where they are geographically.

anyway. I have datetime stamps in my database(mysql) and when i echo these out i want to perform the fix.

I think im close but i dont get why this doesnt work:

$rows['datetime'] = 14/10/08 03:24:22

$datetime = $rows['datetime'];
$datetime = date($datetime, strtotime('-1 hour'));
echo $datetime;

Im expecting this to echo 14/10/08 02:24:22 but it returns the same value as above 14/10/08 03:24:22

Any ideas?
0
satmanuk
Asked:
satmanuk
1 Solution
 
hieloCommented:
$rows['datetime'] = '10/14/08 03:24:22';
$datetime = date('d/m/y H:i:s', strtotime('-1 hour',strtotime($rows['datetime'])) );
echo $datetime;
0
 
satmanukAuthor Commented:
excellent thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now