Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
get value dateTime follow format
posted

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)"

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!

Parents
  • 195
    Offline posted

    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 Kiryu
    Developer support Engineer
    Infragistics

Reply Children