Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Suggested Answer
Replies
6 replies
Answers
1 answer
Subscribers
8 subscribers
Views
3389 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Date Time Issue
ankitab918
over 8 years ago
When I am printing now(), it's returning 9/8/2016 3:11 AM EDT.
But for hour(now()), it's returning: 7
totime(now()): 7:11 AM
Default user timezone is UTC-5:00(Eastern Time)
How do I get the correct hour for the present time?
OriginalPostID-233588
Discussion posts and replies are publicly visible
Top Replies
pavithrac
over 8 years ago
+1
It seems that hour function is not working with datetime time stamp however it accepts time/datetime as per the documentation and also it seems that hour function is working if just time is passed to it…
0
vimalkumars
Certified Lead Developer
over 8 years ago
Can you try the below expression:
hour(totime(local(now())))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Reject Answer
Cancel
0
ankitab918
over 8 years ago
Hi Vimals, This method works. I am able to extract the correct hour, however to change it back to date time, I am using the datetime() function and providing the hour I extracted before, but it is changing to a different value
now():9/8/2016 4:26 AM EDT
hour(totime(local(now()))):4
datetime(year,month,day,hour,min,sec):9/8/2016 12:26 AM EDT
local(datetime(year,month,day,hour,min,sec)):9/7/2016 8:26 PM EDT
todatetime(local(datetime(year,month,day,hour,min,sec))):9/7/2016 8:26 PM EDT
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
pavithrac
over 8 years ago
It seems that hour function is not working with datetime time stamp however it accepts time/datetime as per the documentation and also it seems that hour function is working if just time is passed to it
Can you try the below expression
hour(
text(
now(),
"hh:mm:ss"
)
)
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ankitab918
over 8 years ago
It's not just the hour function, any random hard coded value is also changed to a different time in the datetime function. For eg.,
datetime(2016,9,8,4,30,30,30) returns 9/8/2016 12:30 AM EDT
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 8 years ago
Please have a look at the documentation to understand how appian handles date and time.
forum.appian.com/.../Date_and_Time_Functions.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ankitab918
over 8 years ago
Thanks, I guess userdatetime() solves the issue :)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel