Solved

Timezone script for PHP date

Posted on 2008-10-13
2
684 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
[X]
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
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 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