Greetings:

Building a web form.  There are 3 datetimes:  RequestDate, FulfillDate, and
CancelDate.

New record populates a web form with the current date/time in yyyy-mm-dd
hh:mm:ss format.  RequestDate is current date, FullFillDate and CancelDate are
"0000-00-00 00:00:00".

Updates present them with a record with the yyyy-mm-dd hh:mm:ss formatting
directly selected from the mysql_query.

If the end-user doesn't manipulate the dates, all goes fine.  Just updates
the record with the current values in the web form.

If they want to change one of these dates, they might be inclined to put slashes
in their dates rather than hyphens.  They also might want to just put the day
and the month (no time and no year).

Form submission goes through and I need to put it into yyyy-mm-dd (optionally)
hh:mm:ss format to update the records.

I'm sure this is a common problem, but I haven't seen a decent PHP
implementation of how to error check this and the UNIX_TIMESTAMP(date) function
doesn't like it when the year isn't entered first (for an American
implementation).  So, if the user types 8/15 and hits update, it goes to
0000-00-00 00:00:00.

Best I've come up with is to check for a length of 19 chars, and do some
processing in there.  Chances are there'll only be one slash so an ereg can
determine that and strip the first 2 argv's, pad the rest with zeroes.

Anyone out their have a more complete and elegant way of doing this with a good
yyyy-mm-dd hh:mm:ss ereg check?

Would love to do it cleanly.

Thanks,
Van

=========================================================================
Linux rocks!!!   http://www.dedserius.com
=========================================================================



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to