I am getting a Date from my xml using xpathsnippet funciton and it returns the d

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

Parents
  • 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().
Reply
  • 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().
Children
No Data