Forum Discussion

ykoppisetty's avatar
ykoppisetty
New Contributor II
3 years ago
Solved

Unix Date format to Normal date format

Please help me to convert this below UNIX date format to regular date format,

1445910469510

  • @ykoppisetty

    It is because the parse method expects a number but you are providing a string value.
    You need to parse the “Modified_Date”, you can do so by using parseInt(string).

    In your case would be:

    parseInt($Modified_Date)
    

    And the full expression to format the date would be:

    Date.parse(parseInt($Modified_Date))
    

7 Replies

  • @ykoppisetty

    It is because the parse method expects a number but you are providing a string value.
    You need to parse the “Modified_Date”, you can do so by using parseInt(string).

    In your case would be:

    parseInt($Modified_Date)
    

    And the full expression to format the date would be:

    Date.parse(parseInt($Modified_Date))
    
  • Hi @j.angelevski can you tell how to get dynamically?

    For example, the below field contain all the UNIX date formats so how to get normal date formats dynamically?

    Modified_Date
    1445910469510
    1443298668240
    1428458098640

    • shashish_jha's avatar
      shashish_jha
      New Contributor II

      Date.parse($your_input_date).toLocaleDateTimeString({“format”:“yyyy-MM-dd HH:mm:ss”})
      You can change your desired formatting in this section : “format”:“yyyy-MM-dd HH:mm:ss”
      Place this expression into mapper snap and dynamically your_input_date will be picked up and formatted accordingly.