Jump to content


Photo

Changing the time from the database.


  • Please log in to reply
6 replies to this topic

#1 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 29 October 2006 - 01:22 AM

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.

#2 pendelton

pendelton
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationUK

Posted 29 October 2006 - 01:37 AM

date("h:i:s");

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


#3 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 29 October 2006 - 01:40 AM

I'm sorry, I don't understand the second part of what you said 0_0

#4 pendelton

pendelton
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationUK

Posted 29 October 2006 - 09:35 AM

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

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

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




#5 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 29 October 2006 - 03:32 PM

That printed the time out as 3:00 when it was 9:00....so it didn't work.

I tried this too:

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


#6 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 29 October 2006 - 09:45 PM

Anyone else have any ideas?

#7 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 30 October 2006 - 01:53 AM

Hmmm...no one?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users