--- Gordon Stewart <[EMAIL PROTECTED]> wrote:

> On 10/11/05, Ian Bambury <[EMAIL PROTECTED]> wrote:
> > What version of PHP are you using that
> >
> > echo date("l","2005-08-13");
> > doesn't give you "Thursday"?
> 
> Yes, but ALL dates gave me thursday (or Wednesday) - using the above
> scenario on my database...

And the reason why they gave you the same date is that the string "2005-08-13"
is the wrong input for the second argument of the date function.  For example,
today is Tuesday so if you wanted just the current server day you would use:

print date("l");  // no second argument

If you wanted the day of the week for a specific day:

print date("l", strtotime("2005-08-13"));

The "string to time" function accepts a wide range of inputs (not absolutely
everything but just about) and converts them into an integer of the number of
seconds since an epoch date.  For Unix-type systems this is midnight 1 Jan
1970.  Windows systems may use 1 Jan 1980.  The old MacOS 8, 9 systems used 1
Jan 1984.

If the string given to you by Ian evaluated to a zero, you'd get the day of the
week for the epoch date -- no matter what.  This would be more obvious if you
were displaying the date with a different format string like "F j, Y".

As always, the documentation on the functions is helpful:

  http://www.php.net/date
  http://www.php.net/strtotime

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Fall Semester Begins Sep 7 -- New Classes Start Every Few Weeks.


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to