obscuregirl
Member
Hi
Bit of a newbie question I'm afraid.
My application currently uses datetimepicker controls, but because these can't show blank dates when no date is present/needed, my users (bless 'em!) want to go back to a free format text field for entering dates.
Whilst I'm reluctant to do this as it's caused data problems on the old application that I am currently upgrading (they have a tendency to enter all kinds of different formats), I may well have to bow to pressure and do this. Therefore I want to be able to validate the date string they enter and only allow them to enter an agreed format i.e. dd/mm/yyyy.
I looked at the isDate function but that just checks it's a date and doesn't seem to check if it is a specific format. If they entered "January 2005" instead of "20/01/2005" would this function return false?
Before saving the date to the database, I'm casting the date text to a datetime in the SQL statement, so do I need to enforce a certain format or will just enforcing a recognised date e.g. "20/01/2005" or "20 January 2005" be enough?
Thanks!
Bit of a newbie question I'm afraid.
My application currently uses datetimepicker controls, but because these can't show blank dates when no date is present/needed, my users (bless 'em!) want to go back to a free format text field for entering dates.
Whilst I'm reluctant to do this as it's caused data problems on the old application that I am currently upgrading (they have a tendency to enter all kinds of different formats), I may well have to bow to pressure and do this. Therefore I want to be able to validate the date string they enter and only allow them to enter an agreed format i.e. dd/mm/yyyy.
I looked at the isDate function but that just checks it's a date and doesn't seem to check if it is a specific format. If they entered "January 2005" instead of "20/01/2005" would this function return false?
Before saving the date to the database, I'm casting the date text to a datetime in the SQL statement, so do I need to enforce a certain format or will just enforcing a recognised date e.g. "20/01/2005" or "20 January 2005" be enough?
Thanks!