You are here: Re: How to check if day is Saturday? « PHP Programming Language « IT news, forums, messages
Re: How to check if day is Saturday?

Posted by Chuck Anderson on 11/27/06 00:20

laredotornado@zipmail.com wrote:
> Hi,
>
> I'm using PHP 4.4.4 and I was wondering if anyone knows of a function
> or quick way, given a scalar representation of month (as a number
> between 1 and 12), day, and year (as a four digit number, e.g. 2007),
> how would I tell if that day is a Saturday?
>
> Thanks, - Dave
>
>

Use mktime() with your month day and year as inputs to create a timestamp.
e.g., $tstamp = mktime(0, 0, 0, $month, $day, $year);
.... and then use:
date('l', $tstamp); to get the textual representation of the day of the
week
(or use 'N' to get 1 - 7, 6 being Saturday)

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация