a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

PHP Date() question

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> PHP Date() question
Page: [1]
 
sentinel

 

Posts: 569
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
PHP Date() question - 8/24/2007 9:21:48   
Hey all...

Im trying to echo the date to show the time in different time zones

date("h:m:s")

The problem I am having is say trying to display a time zone that is an hour behind mine..

the above code would show

08:26:03 am

if I do a date("h:m:s")-1 , i display

just an 8

any ideas

_____________________________

No matter where you go, there you are.
womble

 

Posts: 5721
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: PHP Date() question - 9/4/2007 12:09:03   
You managed to solve this one?

This page may help if not: http://www.boutell.com/newfaq/creating/datestamp.html (right down near the bottom of the page)

quote:

The following PHP code, when inserted in an HTML page that has been given a filename ending in .php (not .html), will display the current date and time in New York City:

<?php
putenv('TZ=America/New_York');
echo date("Y-m-d h:i:sa", time());
?>

By default, the date function of PHP also outputs the date and time for the web server's time zone. But the putenv function changes this by setting the effective time zone to the city we want. Linux users can find a list of valid time zone names in the /usr/share/zoneinfo directory (there are subdirectories for continents and so forth). You can leave out the date by skipping the Y-m-d part, and you can leave out the time by skipping the h:i:sa part. For more information about these formatting characters and what else can be done with them, see the PHP manual page for the date function.




_____________________________

~~ "A cruel god ain't no god at all" ~~
~~ Erase hate. Practice love. ~~
:)

(in reply to sentinel)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> PHP Date() question
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts