PDA

View Full Version : Formating a field in the form



ptnfl
05-30-2007, 12:26 PM
Can you format a field in a form i.e. date(00/00/0000, time0:00) etc.?

Pete

www.MusicGrams4U.com (http://www.MusicGrams4U.com)

Andy128
05-30-2007, 04:49 PM
First- what are you trying to accomplish?
Is the date automatically input when the person submits the form?
Or- do you wish to convert the date / time that they enter and put it in a specific format?

IF it is converting the date and time that they enter- Then I would suggest specific instructions on the form to tell the customer just how you want the data input. Even give an example: 01/01/2007 11:20:00

Additinonally, because it is difficult to tell who is entering the data and the date is formated different in many cultures- I would break the fields up into Day-Month-Year and Hours -Minutes. Then you could have the php script put all these together in the format you desire.

If you are wanting the date to be automatically sent at the time of the submission- then the date() function will work for this. In your php script simply ad a line where you declare your variables.
$date = date("m-d-Y h:i:s");

Hope that is what you are looking for?

Andy