Forum Discussion

aspanda's avatar
aspanda
New Contributor II
8 years ago

How to format time stamp?

Date.now().toString() - it provides the result - 2014-09-22T00:00:00.000Z(like this)
but i need time stamp like - 2014-09-22T00:00:00.00Z. I want only two digits before Z.

Thank you for the help in advance

1 Reply

  • aleung's avatar
    aleung
    Contributor III

    Here is your solution:

    Date.now().toString().substr(0,22)+“Z”