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
6 replies
Subscribers
9 subscribers
Views
2800 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I am getting a Date from my xml using xpathsnippet funciton and it returns the d
aneeshv
over 12 years ago
I am getting a Date from my xml using xpathsnippet funciton and it returns the date as a TEXT field.
I want to convert it back to Date to insert it in the db.
todate() function does not seem to work for me since it returns an integer and not a date.
None of the other date functions take input as a text and give output as date..
Is there any such function?...
OriginalPostID-61770
OriginalPostID-61770
Discussion posts and replies are publicly visible
0
aneeshv
over 12 years ago
The date that comes back from the xml as a TEXT is as follows:-
2013-03-14T00:44:04.000Z
Is this a problem with the date that the xml returns or is this a problem with the function?
The o/p of the todate function gives me..
Sep 20, 5838270
This does not seem to me as a valid date format?
And therefore the db insertion is rejected..
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Annelise Dubrovsky
Appian Employee
over 12 years ago
Which Appian version are you using?
I'll find out if there is a more direct way to do this, but until then, this may help you out:
date(split(left(ri!dateText, 10), "-")[1], split(left(ri!dateText, 10), "-")[2], split(left(ri!dateText, 10), "-")[3])
It's simply dropping the time and timezone portions, splitting the remaining text into an array with three elements, and calling the date function on each piece.
I'd recommend putting the logic within a rule e.g. convertFromXmlDate().
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv
over 12 years ago
We are using Appian 6.6.1... Thanks...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
arpitg
over 12 years ago
Have you tried using datetext(ri!date,"dd-MM-yyyy hh:ss"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv
over 12 years ago
Hello Annelise, I now have converted my Date Obtained to dateTime and I am trying to insert it in the db which has timestamp(6) as the data type in Oracle DB.
But shows me 12 a.m. always as time, although the time is not 12 a.m.
The date part is fine.
I am doing the following:-
datetime(split(left(ri!dateText, 10), "-")[1], split(left(ri!dateText, 10), "-")[2], split(left(ri!dateText, 10), "-")[3],split(left(ri!dateText, 13), "T")[2],split(left(ri!dateText, 19), ":")[2],split(left(ri!dateText, 19), ":")[3])
For .e.g 2013-04-01T18:04:15.000Z gives me 4/1/2013 2:04 PM in the rule but in the db it gives me 01-APR-13 12.00.00.000000000 AM always.
How do I get the exact time in db as well.
2.04 p.m. in db too.
Also, I noticed that 18:04 is converted 2:04 p.m. Seems like it is converting date in GMT time when we use dateTime function?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv
over 12 years ago
Ok.. Got my mistake.. I was still referring to DATE instead of Date and Time in a PV although the rule was changed to Date and Time.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel