GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-Aug-2004, 04:31
jlee jlee is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 9
jlee is on a distinguished road

Problems using checkdate


Hi guys

I am using checkdate() as part of a date validation for a form and it seems to work but only if the date is entered in the format MM/DD/YYYY. I need it to work with DD/MM/YYYY - is there any way round this? This is my code:

PHP Code:

list($DD, $MM, $YYYY) = explode("/",$_POST['Date']);
if(!checkdate($DD, $MM, $YYYY))
{
echo "<br><div align=center><font color=red size=+1>The date entered is not a valid date, please try again</font></div></br>";
} 


Thanks
Last edited by Garth Farley : 12-Aug-2004 at 05:15. Reason: Added PHP syntax highlighting
  #2  
Old 12-Aug-2004, 05:19
Garth Farley Garth Farley is offline
Awaiting Email Confirmation
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
Well as you know checkdate takes 3 arguments, MM, DD, YYYY in that order.

You've already split the string to get it's DD, MM, YYYY entries, so just plug them in the correct way:
PHP Code:

list($DD, $MM, $YYYY) = explode("/",$_POST['Date']); 
if(!checkdate($MM, $DD, $YYYY)) 
{ 
echo "<br><div align=center><font color=red size=+1>The date entered is not a valid date, please try again</font></div></br>"; 
} 



GF
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chaintech Geforce 5600 FX problems bartster74 Computer Hardware Forum 8 04-May-2004 13:16
Having problems displaying a line of variable length using winio. warny_maelstrom C Programming Language 8 15-Feb-2004 11:56
CD Burner Problems Joe9995 Computer Hardware Forum 0 07-Feb-2004 10:47
Apache - problems using PHP outside the intranet ooandioo Apache Web Server Forum 6 04-Feb-2004 09:27
Installation problems arman Apache Web Server Forum 3 03-Feb-2004 12:02

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:48.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.