Solved

Timezone script for PHP date

Posted on 2008-10-13
2
679 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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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 …

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now