autofocus Posted July 7, 2009 Share Posted July 7, 2009 Hi. i have a form with date , time and credit card information. i want to validate date, time, credit card number format(after customer select card type from visa amex and mastercard) do i have to use regex? or is there any built in method in php to check date and time. thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 7, 2009 Share Posted July 7, 2009 It kind of depends on how you let the user input the date and time. You may have to convert their input accordingly. But, you may want to take a look at the following functions: For date only: http://us3.php.net/manual/en/function.checkdate.php For a date & time (but a failure will not tell you which one failed) http://us3.php.net/manual/en/function.strtotime.php I'd suggest using the first function to validate the date and then use a custom function for validating the time. Again, this depends on what the input parameters are. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.