Covert Time to UNIX Time

I want to convert the time into UNIX Timestamp. Is it is possible in Appian to convert a time into UNIX Timestamp format?

Thanks in Advance

OriginalPostID-239475

  Discussion posts and replies are publicly visible

Parents
  • Here is a Expression rule that you may use to convert time to a UNIX timestamp. It makes use of the fact that the difference between two datetimes is an interval. I have used it to convert the current datetime (now()) to UNIX timestamp
    with(

    local!unixEpoch : fn!datetime(1970, 1, 1, 0,0,0,0),

    local!intervalDiff: fn!now() - local!unixEpoch,

    local!stringintervalDiff: fn!tostring(local!intervalDiff),

    local!days: fn!tointeger(local!intervalDiff),

    local!stringPartExcludingDays: fn!split(local!stringintervalDiff, "::")[2],

    local!splitPartExcludingDays: fn!split(local!stringPartExcludingDays, ":"),


    local!hours: fn!tointeger(local!splitPartExcludingDays[1]),

    local!minutes: fn!tointeger(local!splitPartExcludingDays[2]),

    local!seconds: fn!tointeger(local!splitPartExcludingDays[3]),

    local!days*24*3600 + local!hours*3600 + local!minutes*60 + local!seconds

    )
Reply
  • Here is a Expression rule that you may use to convert time to a UNIX timestamp. It makes use of the fact that the difference between two datetimes is an interval. I have used it to convert the current datetime (now()) to UNIX timestamp
    with(

    local!unixEpoch : fn!datetime(1970, 1, 1, 0,0,0,0),

    local!intervalDiff: fn!now() - local!unixEpoch,

    local!stringintervalDiff: fn!tostring(local!intervalDiff),

    local!days: fn!tointeger(local!intervalDiff),

    local!stringPartExcludingDays: fn!split(local!stringintervalDiff, "::")[2],

    local!splitPartExcludingDays: fn!split(local!stringPartExcludingDays, ":"),


    local!hours: fn!tointeger(local!splitPartExcludingDays[1]),

    local!minutes: fn!tointeger(local!splitPartExcludingDays[2]),

    local!seconds: fn!tointeger(local!splitPartExcludingDays[3]),

    local!days*24*3600 + local!hours*3600 + local!minutes*60 + local!seconds

    )
Children
No Data