Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Timezone script for PHP date

Posted on 2008-10-13
2
682 Views
Last Modified: 2013-12-13
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
Comment
Question by:satmanuk
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 22708477
$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
 
LVL 1

Author Comment

by:satmanuk
ID: 22713652
excellent thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question