|
-
Jul 18th, 2003, 11:48 AM
#1
Thread Starter
Fanatic Member
Display day of week from date [RESOLVED]
I have a list of dates in the following format:
14/Jun/2003
18/Jul/2003
09/May/2003
...
This list will keep continuing to grow so it can not be hard coded.
I would like to be able to determine from this date format what the day of the week it is (Mon, Tues, Wed, etc...). Is this even possible? I know that if I had the month in a numberic value I could use:
getdate(mktime(0,0,0,$month, $day, $year)).
My second question would be then, Is it possible to convert a month, Jul to 07?
Thanks for the help in advance.
Last edited by lleemon; Jul 18th, 2003 at 12:38 PM.
-
Jul 18th, 2003, 11:58 AM
#2
Stuck in the 80s
Why are you saving the date like that?
If you would save it in any kind of normal format, the php date() function would answer your two questions in one line of code.
But they cannot understand that format.
-
Jul 18th, 2003, 12:02 PM
#3
Stuck in the 80s
Example:
Code:
<?php
$date = "14/06/2003";
echo "The day of the week is " . date('D', strtotime($date)) . ".<br>";
?>
-
Jul 18th, 2003, 12:04 PM
#4
Stuck in the 80s
I suppose you could always pull this number:
Code:
<?php
$date = "14/Jun/2003";
$dp = explode('/', $date);
$newdate = "$dp[1] $dp[0], $dp[2]";
echo "The day of the week is " . date('D', strtotime($newdate)) . ".<br>";
echo "The month number is " . date('m', strtotime($newdate)) . ".<br>";
?>
Last edited by The Hobo; Jul 18th, 2003 at 12:56 PM.
-
Jul 18th, 2003, 12:37 PM
#5
Thread Starter
Fanatic Member
The Hobo,
Works very nice!
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|