RE: [PHP] how to get day of week?
| From: | Mark Roedel | Date: | Tue, 22 Aug 2000 20:48:28 +0000 |
| Subject: | RE: [PHP] how to get day of week? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13019@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: kev [mailto:kevin.porter@fast.no]
> Sent: Tuesday, August 22, 2000 6:39 AM
> To: php-general@lists.php.net
> Subject: [PHP] how to get day of week?
>
>
> I need to find out the day of the week for a given date in mysql DATE
> format.
If you're wanting to do it in PHP, you'll need
substr() (or something similar)
(to break apart the pieces of the mysql timestamp)
http://www.php.net/manual/function.substr.php
mktime()
(to generate a Unix timestamp from those pieces)
http://www.php.net/manual/function.mktime.php
date()
(to format the timestamp into day-of-week)
http://www.php.net/manual/function.date.php
(especially the "D", "w", and "l" specifiers)
Since the timestamp is, presumably, coming from a mysql query, you might
also look at the date_format() function, which you can use in your query.
It's documented about two-thirds of the way down
http://www.mysql.com/documentation/mysql/commented/manual.php?section=Date_a
nd_time_functions
(that's all one line, of course, in case your mail client wrapped it.) (The
"%a", "%w", and "%W" format specifiers will likely be of particular
interest.)
---
Mark Roedel | "Blessed is he who has learned to laugh
Systems Programmer | at himself, for he shall never cease
LeTourneau University | to be entertained."
Longview, Texas, USA | -- John Powell