Jump to content

uk date problem


crag

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?
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.