Jump to content

Archived

This topic is now archived and is closed to further replies.

pocobueno1388

Changing the time from the database.

Recommended Posts

Hello everyone. I was just wondering how I would take a timestamp from the database like this:
16:48:11

and change it to central time (US). I have played with the date() function, but I couldn't figure it out. I also don't want it to appear in military time.

I appreciate all your help ^^ Thanks.

Share this post


Link to post
Share on other sites
date("h:i:s");

Use putenv("TZ=GB"); to set your timezone (you will need to replace GB with UST or similar).

Share this post


Link to post
Share on other sites
I assume that the timezone on you machine is not central time US? If it is then you don't need the putenv. However, the server isn't using central US time you will need to write to code as follows:

Use

[code]
<?
putenv("TZ=US");
print date("h:i:s");
?>
[/code]

Try the above then chage "TZ=US" to "TZ=GB" (TZ stands for timezone).


Share this post


Link to post
Share on other sites
That printed the time out as 3:00 when it was 9:00....so it didn't work.

I tried this too:

[code]
<?
putenv("TZ=US/central");
print date("h:i:s");
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.