Hi,
I'm using igDateEditor with format "mm/dd/yyyy hh:mm a" (example: 01/01/2017 06:00 AM).
And, I'm getting value by
editorVal = $(".selector").igDateEditor("value") // and value now is "Sun Jan 01 2017 06:00:00 GMT+0700 (ICT)"
editorVal = $(
".selector"
).igDateEditor(
"value"
) // and value now is "Sun Jan 01 2017 06:00:00 GMT+0700 (ICT)"
But, I need get my value as same as format type ('01/01/2017 06:00 AM'). How can I get it?
Thank in advance!
Hello Duong,
Thank you for contacting Infragistics Developer Support.
To achieve what you want, you can use dateDisplayFormat and dataMode options.
http://www.igniteui.com/help/api/2016.2/ui.igdateeditor#options:dateDisplayFormat http://www.igniteui.com/help/api/2016.2/ui.igdateeditor#options:dataMode
Here is a igDateEditor's configuration.
$('.selector').igDateEditor({ dateDisplayFormat: 'MM/dd/yyyy hh:mm tt', dateInputFormat: 'MM/dd/yyyy hh:mm tt', // It's an optional. If you want to format the value while editing as well. dataMode: 'displayModeText' });
Then you will be able to get the editor's value as a formated string.
$('.selector').igDateEditor("value") // 01/01/2017 06:00 AM
I hope this will help.Let me know if I may be of further assistance.
Best regards,Tatsushi KiryuDeveloper support EngineerInfragistics
Thank for your answer.
I got it but value's type is String/Text.
Can I get it's type as Date/Time?
Thanks for your support.
Your answer clarified my questions. I will decide best way for my issue.
When you want to get the value as Date type, you should set dataMode to 'date'.When you want to get the value as formatted, the value must be converted Date to String, so you should set dataMode to 'displayModeText'.
You cannot get the Date type value with formatted at one time.
If I misunderstood what you meant, please let me know.