DMXzone Calendar Support Product Page

Display as mm/dd/yyyy, insert as yyyy-mm-dd

Asked 29 Aug 2011 06:24:47
1
has this question
29 Aug 2011 06:24:47 Robert Robinette posted:
Is there a simple way to display the date format as mm/dd/yyyy but upon insert into a mysql db, convert the format to yyyy/mm/dd?

Obviously when you use mm/dd/yyyy to display the format when inserting it shows 0000-00-00. I have used an explode function in the past with datepickers I've used before, but it doesn't seem to work with this extension.

<?php
if (isset($_POST['date'])) {
$date = explode('/', $_POST['date']);
$_POST['date'] = "$date[2]-$date[0]-$date[1]";
}
?>


If there's no simple way to convert this on insert then I'll have to go back and use my old datepicker method and this will have been a waste of money. Too bad because I do like a lot of the features.

Replies

Replied 29 Aug 2011 11:49:53
29 Aug 2011 11:49:53 Miroslav Zografski replied:
Hello Robert,

This function must be working just fine.
You may need to check if the $_POST['date'] returns exactly what you expect it to. Try echoing it.

As for the simple way ... The calendar accepts a custom date formats - you can type in the date format your own like - dd/mm/yy

Reply to this topic