Page 1 of 1
Dear Server...
Posted: Thu Sep 13, 2007 8:57 pm
by JellyFish
Dear Server. I don't know why but when I tell you "date('Y-m-d')" you seem to think it's Friday... Please explain your logic in this: Are you thinking in GMT? I'd like you to think more on the lines of Pacific Standard Time. How could I get you to think differently?
Sincerely, Jellyfish.
Posted: Thu Sep 13, 2007 9:11 pm
by Christopher
Dear PHP Manual,
Thanks for showing me examples of how to do this on your page about the date() function. Oh, and thanks for the examples and the related function that is used to set the default timezone. Wow PHP Manual, that was easy and fun too.
Sincerely,
arborint
Posted: Thu Sep 13, 2007 9:23 pm
by JellyFish
arborint wrote:Dear PHP Manual,
Thanks for showing me examples of how to do this on your page about the date() function. Oh, and thanks for the examples and the related function that is used to set the default timezone. Wow PHP Manual, that was easy and fun too.
Sincerely,
arborint
Thanks for the response. But I'm not able to use date_timezone_set() nor date_default_timezone_set(), 'cause I'm running php 4.
Is there no other way to do this?
Posted: Thu Sep 13, 2007 9:35 pm
by Christopher
From looking at the manual you could do something like:
Code: Select all
$my_timezone_date = date('Y-m-d', mktime() + date('Z'));
Posted: Thu Sep 13, 2007 9:47 pm
by JellyFish
arborint wrote:From looking at the manual you could do something like:
Code: Select all
$my_timezone_date = date('Y-m-d', mktime() + date('Z'));
I'm not understanding, what's a time stamp? This is what I have:
Code: Select all
$sql = "INSERT INTO linkcount (site, IP, date) VALUES ('YourFreeiPhone.com', '$_SERVER[REMOTE_ADDR]', '".date("Y-m-d")."')";
What should I change?
Posted: Thu Sep 13, 2007 10:01 pm
by Zoxive
Dear php,
Why not use my Built in Function called
Now()?
Sincerely,
Mysql
Posted: Thu Sep 13, 2007 11:22 pm
by JellyFish
Zoxive wrote:Dear php,
Why not use my Built in Function called
Now()?
Sincerely,
Mysql
Now() works exactly the same as date("Y-m-d"). But what I don't understand is, why is the result "2007-09-14"? Is it the fourteenth?
Posted: Thu Sep 13, 2007 11:24 pm
by feyd
The server is likely set or located in a timezone where it is the fourteenth. Are you thinking the server should somehow magically know your timezone and display it accordingly?
Posted: Thu Sep 13, 2007 11:29 pm
by JellyFish
feyd wrote:The server is likely set or located in a timezone where it is the fourteenth. Are you thinking the server should somehow magically know your timezone and display it accordingly?
No, my original question, I'm sorry I wasn't so clear, was: How can I get my server to display PST?
Posted: Thu Sep 13, 2007 11:37 pm
by feyd
arborint's post shows how to adjust the time, artificially.
Posted: Fri Sep 14, 2007 12:30 am
by Christopher
JellyFish wrote:I'm not understanding, what's a time stamp?
You can't make this stuff up:
http://www.unixtimestamp.com
Posted: Fri Sep 14, 2007 12:54 am
by mrkite
dunno if it works from apache, but it definitely works from php-cli:
Code: Select all
putenv("TZ=MST");
// date() now uses MST