SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: timezone...
-
Jan 30, 2001, 20:18 #1
- Join Date
- Dec 1999
- Posts
- 85
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I would like to change the timezone in PHP tempoarily from EST to PST. How do I do this?
Also, could anyone tell me how to change a date format in timestamp(14) to something readable like this January 30th, 2001. I know how to do this in a mySQL query, but not in plain PHP.
Your help is much appreciated.
-
Jan 30, 2001, 20:40 #2
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
1)
To change time zones from EST to PST we need to subtract 3 hours
$pdate = date("g:i:s A", mktime(date("G") - 3, date("i"), date("s"), date("m"), date("d"), date("Y")));
print $pdate;
2)
First use UNIX_TIMESTAMP(datefield) in your select field so you have a unix time stamp to work with. Assign it to a var lets say $utime
print DATE("F jS, Y", $utime);
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jan 30, 2001, 21:20 #3
- Join Date
- Dec 1999
- Posts
- 85
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks, but the 2nd one doesn't work.
First use UNIX_TIMESTAMP(datefield) in your select field so you have a unix time stamp to work with. Assign it to a var lets say $utime
print DATE("F jS, Y", $utime);
Here's my code
<? print DATE("F j, Y", $row[updated]); ?>
and that's the output page...
http://www.usbworkshop.com/hardware/rvw.php3?id=569
"...Full review January 18, 2038..."
-
Jan 30, 2001, 21:48 #4
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What does the query look like? Why are you against doing it in the query anyways?
SELECT UNIX_TIMESTAMP(update) as utime from tablename;
or SELECT DATE_FORMAT(updated, '%Y %m %d') as utime from tablenamePlease don't PM me with questions.
Use the forums, that is what they are here for.
-
Jan 30, 2001, 21:54 #5
- Join Date
- Dec 1999
- Posts
- 85
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I need to change a lot codes just to do this...
What's wrong with this anyway?
Thanks.
-
Jan 30, 2001, 22:04 #6
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I guess what it boils down to you are not explaining yourself very well. Your first post says
Also, could anyone tell me how to change a date format in timestamp(14) to something readable like this January 30th, 2001. I know how to do this in a mySQL query, but not in plain PHP.
Does that clear it up for you? Please clarify and we can help you much betterPlease don't PM me with questions.
Use the forums, that is what they are here for.
Bookmarks