If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Convert date DD/MM/YYYY to DDD

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-08-03, 04:42
philhowell philhowell is offline
Registered User
 
Join Date: Jan 2003
Location: UK
Posts: 27
Red face Convert date DD/MM/YYYY to DDD

i have the date taken form a mySQL db set in this format - DD/MM/YYYY - (i.e. 21/01/2003), and i want it to display the day for that particular date... i.e Tuesday .......

any suggestions
Phil
Reply With Quote
  #2 (permalink)  
Old 04-08-03, 05:39
gannet gannet is offline
Registered User
 
Join Date: Oct 2002
Location: Plymouth UK
Posts: 116
There are 2 ways you could do this:

1. Get the date from database utilities see MySQL documentation (I only know the Oracle commands)

2. In PHP you could do this

date("l", mktime(0,0,0,mm,dd,yyyy));

Cutting the month, day and year parts from your date string. This would return the day

e.g.
echo (date("l", mktime(0,0,0,4,8,2003)));

would return Tuesday.
Reply With Quote
  #3 (permalink)  
Old 04-09-03, 16:41
mcbond mcbond is offline
Registered User
 
Join Date: Apr 2003
Posts: 3
DATE_FORMAT(date,format)

Where format:
%W Weekday name (Sunday..Saturday)

eg.:
SELECT DATE_FORMAT(date_field,"%W") as date_field FROM table


visit www.php.net/manual/en/function.date.php and search for:
junk at glued2 dot net
16-Feb-2002 07:54

You'll get a full list
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On