note 17259 modified in function.checkdate by zak

From: Date: Sun, 02 Dec 2001 08:13:25 +0000
Subject: note 17259 modified in function.checkdate by zak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21525@lists.php.net to get a copy of this message
[Editor's Note: This function is best suited to situations where one has individual fields of date data to work with. For working with free-form text dates, see strtotime() --zak@php.net] One thing I am seeing in all these replies is that you are assuming the user (idiot) is going to enter a date in the format you want. What if they enter "my dog?" Here are some other entries that wouldn't pass through the sample codes I've seen so far: Nov 31, 70 November 31, 1970 11 31, 70 11/31.1970 Never underestimate stupid users. With ASP I could simply throw anything into IsDate("Insert_Input_Here") and it would tell me if that value was a date or not. From there I was free to format it anyway I wanted to. I have switched from ASP to PHP and I'm amazed that such a basic request is not taken care of naturally, instead of coming up with hacks to do the job. Signed, Sad --was-- One thing I am seeing in all these replies is that you are assuming the user (idiot) is going to enter a date in the format you want. What if they enter "my dog?" Here are some other entries that wouldn't pass through the sample codes I've seen so far: Nov 31, 70 November 31, 1970 11 31, 70 11/31.1970 Never underestimate stupid users. With ASP I could simply throw anything into IsDate("Insert_Input_Here") and it would tell me if that value was a date or not. From there I was free to format it anyway I wanted to. I have switched from ASP to PHP and I'm amazed that such a basic request is not taken care of naturally, instead of coming up with hacks to do the job. Signed, Sad http://www.php.net/manual/en/function.checkdate.php

« previous php.notes (#21525) next »