Re: [PHP-DB] Date Returns
Does anyone know if the date function returns false if it cannot convert the specified date/time to the format? If not, does anyone have a rule set they use to verify the date is a valid convertible date? I need to update a row in MSSQL, and it will fail if the date is incorrect. I've validated for the basic things, but just am not sure what the best way would be to validate the actual date itself. I was thinking of RegExp, but not certain if that would really work for multiple date formats for example: March 15, 2002 03/15/2002 3/15/2002 and so on and so forth. The field actually requests a dd/mm/yy format, but you know how people follow instructions. Use MMDD HH:MM:SS (without -) format date when inserts or updates fields in MSSQL, MYSQL etc. For example: INSERT INTO tblxxx (fielddatetime,fieldother) VALUES ('20020311 18:33:44','something else') I use it in that way and it is the best method I think. Mayby you may use odbc structure {ts '-mm-dd hh:mm:ss'} For example: INSERT INTO tblxxx (fielddatetime,fieldother) VALUES ({ts '20020311 18:33:44'},'something else') good luck with dates ;-) BTW I recommend you to explore MSSQL Book Online! It has quite good and a lot of knowledge. Konrad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Returns
Does anyone know if the date function returns false if it cannot convert the specified date/time to the format? If not, does anyone have a rule set they use to verify the date is a valid convertible date? I need to update a row in MSSQL, and it will fail if the date is incorrect. I've validated for the basic things, but just am not sure what the best way would be to validate the actual date itself. I was thinking of RegExp, but not certain if that would really work for multiple date formats for example: March 15, 2002 03/15/2002 3/15/2002 and so on and so forth. The field actually requests a dd/mm/yy format, but you know how people follow instructions. Thanks guys, Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date Returns
On Saturday 16 March 2002 00:14, Ryan Marrs wrote: Does anyone know if the date function returns false if it cannot convert the specified date/time to the format? If not, does anyone have a rule set they use to verify the date is a valid convertible date? I need to update a row in MSSQL, and it will fail if the date is incorrect. I've validated for the basic things, but just am not sure what the best way would be to validate the actual date itself. I was thinking of RegExp, but not certain if that would really work for multiple date formats for example: March 15, 2002 03/15/2002 3/15/2002 and so on and so forth. The field actually requests a dd/mm/yy format, but you know how people follow instructions. checkdate() -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Absence in love is like water upon fire; a little quickens, but much extinguishes it. -- Hannah More */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php