PHP Timezone and Day of the week function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pav9495
Forum Newbie
Posts: 5
Joined: Tue Aug 10, 2010 11:45 am

PHP Timezone and Day of the week function

Post 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. :)
Pav9495
Forum Newbie
Posts: 5
Joined: Tue Aug 10, 2010 11:45 am

Re: PHP Timezone and Day of the week function

Post by Pav9495 »

so can someone help ?
mattbranch12
Forum Newbie
Posts: 18
Joined: Thu Jul 09, 2009 3:14 pm
Location: Hagerstown, MD

Re: PHP Timezone and Day of the week function

Post 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
Pav9495
Forum Newbie
Posts: 5
Joined: Tue Aug 10, 2010 11:45 am

Re: PHP Timezone and Day of the week function

Post 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.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: PHP Timezone and Day of the week function

Post by Eran »

mattbranch12
Forum Newbie
Posts: 18
Joined: Thu Jul 09, 2009 3:14 pm
Location: Hagerstown, MD

Re: PHP Timezone and Day of the week function

Post by mattbranch12 »

Pretty easy to print the day of the week.

Code: Select all

echo date("l");
Pav9495
Forum Newbie
Posts: 5
Joined: Tue Aug 10, 2010 11:45 am

Re: PHP Timezone and Day of the week function

Post by Pav9495 »

thanx a lot!!!
Post Reply