Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Timezone script for PHP date

Posted on 2008-10-13
2
Medium Priority
?
687 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
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…

670 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