|
Posted by Alvaro G Vicario on 06/27/05 13:00
*** ndsoumah@gmail.com wrote/escribió (26 Jun 2005 21:04:47 -0700):
> 1- convert the input string into date first. At this point I couldn't
> find any srtTOdate type of functions.
In the "Date and Time Functions" chapter of the PHP manual you have all
date and time functions, including strtotime()
then I tried doing it the hard
> way...by using "checkdate" function. I could split the string fine
> (using "explode") but then I was stuck because I couldn't find any
> function to convert a string into Integer!
>
> 2- I need to check if the date is valid
As you already mentioned, checkdate sounds like a good option.
You may also find useful this code for a previous additional client-side
validation:
/*
* Returns true if valid date, false otherwise
* Month range is [1,12]
*/
function is_date(day, month, year // v2005-03-14
var TheDate=new Date();
TheDate.setFullYear(year, month-1, day);
return (TheDate.getDate()==day) && (TheDate.getMonth()==month-1) &&
(TheDate.getFullYear()==year);
}
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Navigation:
[Reply to this message]
|