format date in editor
format date in editor
AloneInTheDark
Posts: 30Questions: 7Answers: 0
Hi,
i have a two fields date and datatime. I recive this date from php : 2016-03-07T08:28:00+0000
and i want format like DD-MM-YYYY HH:MM:SS. My settings are (editor):
fields: [
....
{
label: "Date",
name: "data1",
type: "date",
format: "dd-mm-yy",
def: function ()
{
var date=moment().format('DD-MM-YYYY');
return date;
},
},
{
label: "Date",
name: "data2",
type: "datetime",
format: "DD-MM-YYYY HH:mm:ss",
def: function ()
{
var date=moment().format('DD-MM-YYYY');
return date;
},
},
....
but field datetime show "2016-03-07T08:28:00+0000"
and date show "2015-12-30" in update form, but when add a record
is OK.
Why?
tnk
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Replies
I would suggest that you perform the formatting on the server-side using the formatting functions. The
datetime
field type won't convert from one form to another, it just uses a single form.Allan
Hi Allan,
i use my php class and output is json string, like this:
but when i open update form show "2016-03-07T08:28:00+0000"
:(
help!
Could you give me a link to the page so I can take a look and see what is going wrong please?
For the default - you can just return a
Date
object - you don't need to format it (and if you did you would need to format it to match the full format).Thanks,
Allan