Saving the time with Bootstrap DateTimePicker (2)
Saving the time with Bootstrap DateTimePicker (2)
Bootstrap DateTimePicker (2) has an example with no time information saved.
When I use the time component I've got a problem.
Date and time are shown OK from the database.
But on changing the date and time of the field with the picker, the date is saved OK but the time is lost (set to 00:00).
The info is also send correctly to my php-script:
data[row_1][todo][deadline]:"24-09-2015+10:44"
Any ideas?
I'm using this php code:
Field::inst( 'todo.deadline' )
->validator( 'Validate::dateFormat', array("empty"=>false, "format" => "d-m-Y H:i", "message" => "Enter like this: dd-mm-jjjj hh:mm"))
->getFormatter( 'Format::date_sql_to_format', 'd-m-Y H:i' )
->setFormatter( 'Format::date_format_to_sql', 'd-m-Y H:i' ),
and this javascript code:
{
label: "deadline:",
name: "todo.deadline",
type: "datetime",
opts: {
showTodayButton: true,
format: 'DD-MM-YYYY HH:mm'
},
dateImage: "calender.png"
},
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
What you need to do here is use the
datetime
formatter and give itto
andfrom
parameters. This is required because the formatters you are using at the moment only operate with dates, not times as well.So you might end up with:
Regards,
Allan
Great, that's what I needed.
Thanks.