Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
12 replies
Subscribers
8 subscribers
Views
7836 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Covert Time to UNIX Time
sahilb
over 8 years ago
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
Top Replies
chetany
over 8 years ago
+1
A Score Level 1
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…
Parents
0
chetany
A Score Level 1
over 8 years ago
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
)
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
chetany
A Score Level 1
over 8 years ago
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
)
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data