Forum Discussion

JeremyLahners's avatar
JeremyLahners
Qrew Cadet
3 years ago

Convert timestamp to Date/Time

Hi friends! I am trying to convert a timestamp over to a Date/Time field and am failing miserably.  I have a text string that am I am extracting elements from using multiple formula fields, one of ...
  • PrashantMaheshw's avatar
    3 years ago
    Hey Jeremy ,

    TimeStamp you posted is Zulu Time ,you can read about in on google , basically it's GMT time and we need to add our time difference to it . 

    var text utc="2022-08-11T13:18:08+00:00"; // Declare your field here 
    var date pdate = ToDate(Part($utc,1,"T"));   // Extracting Date

    var text pa = Part(Part($utc,2,"T"),1,"+"); // Extracting GMT Time 
    var TimeOfDay ptime = ToTimeOfDay($pa)+Hours(5)+Minutes(30);  // Adding Time difference 5hours 30 minutes is IST Time difference, you will add or subtract yours.

    ToTimestamp($pdate, $ptime)

    ------------------------------
    Prashant Maheshwari
    ------------------------------