Page 1 of 1

PHP Timezone and Day of the week function

Posted: Tue Aug 10, 2010 11:51 am
by Pav9495
I don't understand how the two functions mentioned in the name above work, so I need some help. I want to make a php file with those two functions by entering my time zone so it knows what day of the week it is where I live and to display that day. My time zone is GMT +3. I would really appreciate it if someone can help me with this script. :)

Re: PHP Timezone and Day of the week function

Posted: Wed Aug 11, 2010 11:35 am
by Pav9495
so can someone help ?

Re: PHP Timezone and Day of the week function

Posted: Wed Aug 11, 2010 11:59 am
by mattbranch12
You can set the time zone using this function

Code: Select all

date_default_timezone_set('America/Los_Angeles');
All you have to do is replace America/Los_Angeles with the time zone that you want.

Here is a list of Time zones.

http://www.php.net/manual/en/timezones.php

Re: PHP Timezone and Day of the week function

Posted: Thu Aug 12, 2010 4:44 am
by Pav9495
thanx for that, but it's not the only thing that I needed. I also need a way to display what day of the week it is.

Re: PHP Timezone and Day of the week function

Posted: Thu Aug 12, 2010 6:38 am
by Eran

Re: PHP Timezone and Day of the week function

Posted: Thu Aug 12, 2010 8:52 am
by mattbranch12
Pretty easy to print the day of the week.

Code: Select all

echo date("l");

Re: PHP Timezone and Day of the week function

Posted: Thu Aug 12, 2010 11:58 am
by Pav9495
thanx a lot!!!