Last active
May 26, 2023 07:56
-
-
Save justinyoo/8d3dcf352682ca73c34d98d7601f1145 to your computer and use it in GitHub Desktop.
Converting Tick or Epoch to Timestamp in Logic App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"token_type": "Bearer", | |
"access_token": "[ACCESS_TOKEN_VALUE]", | |
"expires_on": "1536543296", | |
"not_before": "[ANOTHER_EPOCH_VALUE]" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConvertEpochToTimestamp: | |
type: Compose | |
runAfter: | |
GetTimestampInEpoch: | |
- Succeeded | |
inputs: | |
timestamp1: "@addToTime('1970-01-01T00:00:00Z', 1536543296, 'Second')" | |
timestamp2: "@addSeconds('1970-01-01T00:00:00Z', 1536543296)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Really nice!! working for me. Thanks