[PHP] Date validation

2011-05-20 Thread Geoff Lane
Hi All, I'm scratching my head trying to remember how I validated string representation of dates 'the first time around' with PHP (before going over to ASP/VBScript for almost a decade). I have a feeling that I must have rolled my own validation function, because I can't find anything other than s

RE: [PHP] Date Validation, Kinda'

2003-08-21 Thread Jay Blanchard
[snip] I'm thinking this: 1. you get the date from the user 2. validate it using checkdate() 3. get the current date 4. compare the two dates to see if the users date is later than todays date 5. return true or return false Sound good? [/snip] Sounds bueno! I am just tired, had checkdate() in ha

RE: [PHP] Date Validation, Kinda'

2003-08-21 Thread Chris W. Parker
Jay Blanchard on Thursday, August 21, 2003 1:24 PM said: > It is to make sure that the user has entered a valid future date in > the MMDD format into the form. (You may very well already know of these two functions and already thought of what I'm going to tell y

RE: [PHP] Date Validation, Kinda'

2003-08-21 Thread Jay Blanchard
[snip] Now that I'm thinking about it, what is your goal with this? Is it to make sure the date entered is within a certain range when compared to another date? i.e. The date entered cannot be more than absolutevalue(10 days) away from the first date or is it just to make sure it's in the proper fo

RE: [PHP] Date Validation, Kinda'

2003-08-21 Thread Chris W. Parker
Jay Blanchard on Thursday, August 21, 2003 12:30 PM said: > Has anyone written any date validation function or sequence. Now that I'm thinking about it, what is your goal with this? Is it to make sure the date entered is within a certain range when compared to anoth

Re: [PHP] Date Validation, Kinda'

2003-08-21 Thread Brent Baisley
I wrote a little function to check if a date is valid. All the hard stuff is done by the checkdate() function, but function just returns a date if valid or false if not: function validDate($year,$month,$day) { if(checkdate($month,$day,$year)) { return date("Y-m-d", mktime(0,0,0,$month,$day,$ye

[PHP] Date Validation, Kinda'

2003-08-21 Thread Jay Blanchard
Howdy, Has anyone written any date validation function or sequence. I have looked around, but haven't found anything. I am cobbling togather something, but was hoping to not have to re-invent the wheel. The date is formatted MMDD and is input by the user; $userCentury = substr($userDate, 0, 2

Re: [PHP] date validation problem!

2002-10-31 Thread 1LT John W. Holmes
> I am having some problem with date validation > I am trying to validate the date in a form Field > I had provided a text field for date, so have to > expect all the different possible entry, > When i tried with checkdate() method it needs the > parametes in (int month,int date, int year). It make

RE: [PHP] date validation problem!

2002-10-31 Thread Jon Haworth
Hi, > I had provided a text field for date, so have to > expect all the different possible entry, This is generally a *very* bad idea. If a visitor to your site enters "4/3/01", do they mean the 4th March or the 3rd April? I find the best thing to do is provide three drop-downs: one contains nu

[PHP] date validation problem!

2002-10-31 Thread ppf
Hi all: I am having some problem with date validation I am trying to validate the date in a form Field I had provided a text field for date, so have to expect all the different possible entry, When i tried with checkdate() method it needs the parametes in (int month,int date, int year). It make