Jump to content


Photo

uk date problem


  • Please log in to reply
1 reply to this topic

#1 crag

crag
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 21 March 2006 - 10:08 PM

I have a number of forms on my site that the user will have to enter a date but they have to enter this using the format YYYY-MM-DD. As im from the uk I would like them to enter the date in the format DD-MM-YY.

I am using the date_format() function when I output the date to screen but I need a way to format the date before the user has to enter it into the form.

Is there an in built mysql date column type that will do this or will I have to this using my own php script?

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 22 March 2006 - 01:58 AM

Try using date().

echo date("d-m-y");

If you need it to display a specific date, use the mktime or strtotime functions.

[a href=\"http://www.php.net/date\" target=\"_blank\"]http://www.php.net/date[/a]
[a href=\"http://www.php.net/mktime\" target=\"_blank\"]http://www.php.net/mktime[/a]
[a href=\"http://www.php.net/strtotime\" target=\"_blank\"]http://www.php.net/strtotime[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users