jQWidgets Forums

jQuery UI Widgets Forums Grid change the date into timestamp

This topic contains 5 replies, has 2 voices, and was last updated by  Nadezhda 10 years, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • change the date into timestamp #67555

    pankhi
    Participant

    i want to change the date in timestamp in jqxgrid.
    I am using any API that returns date like “2015-02-16 11:03:19.000000” in jqxwidget i want to change its dateformat so to do that I need to convert it into timestamp to get its proper date format like (m-d-y);
    Can you please tell me how can i change date to timestamp

    change the date into timestamp #67568

    Nadezhda
    Participant

    Hello pankhi,

    If you want to change the date format you can achieve it with ‘cellsformat’ column property. Here is an example: http://jsfiddle.net/h5hsmbz0/.

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

    change the date into timestamp #67650

    pankhi
    Participant

    cellsformat: ‘yyyy-MM-dd’ helps us to change the date format .
    My API returns me date like “2015-02-16 11:03:19.000000” and the cellsformat is not working for the above date.
    SO i want to convert the given date into unix date time like strtotime(‘2015-02-16 11:03:19.000000’); and than wanted to convert it into date format.

    change the date into timestamp #67652

    Nadezhda
    Participant

    Hi pankhi,

    You can try with ‘getTime’ JavaScript method which is equivalent of php’s ‘strtotime’. The getTime() method returns the number of milliseconds between midnight of January 1, 1970 and the specified date. Here is an example which shows how to use the date constructor to parse a date and get the milliseconds from the getTime() method.

    var d=new Date("2015-02-16 11:03:19.000000");
    document.write(d.getTime() + " milliseconds since 1970/01/01");

    I hope that the above example will be helpful to you.

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

    change the date into timestamp #67698

    pankhi
    Participant

    no it’s working for me? is it working for you?

    change the date into timestamp #67751

    Nadezhda
    Participant

    Hi pankhi,

    Do you try to convert the number from milliseconds to seconds?

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.