Jump to content

Archived

This topic is now archived and is closed to further replies.

crag

uk date problem

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Try using date().

[code]echo date("d-m-y");[/code]

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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.