Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active November 3, 2018 11:26
Embed
What would you like to do?
Converting Tick or Epoch to Timestamp in Logic App
{
"token_type": "Bearer",
"access_token": "[ACCESS_TOKEN_VALUE]",
"expires_on": "1536543296",
"not_before": "[ANOTHER_EPOCH_VALUE]"
}
ConvertEpochToTimestamp:
type: Compose
runAfter:
GetTimestampInEpoch:
- Succeeded
inputs:
timestamp1: "@addToTime('1970-01-01T00:00:00Z', 1536543296, 'Second')"
timestamp2: "@addSeconds('1970-01-01T00:00:00Z', 1536543296)"
GetTimestampInEpoch:
type: Compose
runAfter:
GetTimestampInTicks:
- Succeeded
Get1970TimestampInTicks:
- Succeeded
inputs:
epoch: "@div(sub(636721400967890200, 621355968000000000), 10000000)"
ConvertTicksToTimestamp:
type: Compose
runAfter:
GetTimestampInEpoch:
- Succeeded
inputs:
timestamp: "@addToTime('1970-01-01T00:00:00Z', outputs('GetTimestampInEpoch').epoch, 'Second')"
GetTimestampInTicks:
type: Compose
runAfter: {}
inputs:
ticks: "@ticks('2018-09-10T12:34:56+11:00')"
Get1970TimestampInTicks:
type: Compose
runAfter: {}
inputs:
ticks: "@ticks('1970-01-01T00:00:00Z')"
GetTimestampInEpoch:
type: Compose
runAfter:
GetTimestampInTicks:
- Succeeded
Get1970TimestampInTicks:
- Succeeded
inputs:
epoch: "@div(sub(outputs('GetTimestampInTicks').ticks, outputs('Get1970TimestampInTicks').ticks), 10000000)"
GetTimestampInTicks:
type: Compose
runAfter: {}
inputs:
ticks: "@ticks('2018-09-10T12:34:56+11:00')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment