Function to convert text to date

Is there a function available to convert text to date? for example "16 Sep 2015 13:49:21 GMT" >>> "09/16/2015 12:39 GMT"

OriginalPostID-167707

OriginalPostID-167707

  Discussion posts and replies are publicly visible

  • I do not find any OOTB option, Hence created reusable custom expression to convert local date and time. Please leverage if you want

    =with(
    local!months : {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},
    local!timeZone : "America/New_York",
    local!fullArray: split(ri!dateText, " "),
    local!timeArray: split(left(local!fullArray[4], 8), ":"),
    local!rawDate: datetime(
    local!fullArray[3],
    wherecontains(local!fullArray[2],local!months),
    local!fullArray[1],
    local!timeArray[1],
    local!timeArray[2],
    local!timeArray[3]
    ),
    local(local!rawDate,
    local!timeZone
    )
    )
  • I had a similar requirement and used userdatetime() instead of datetime() .. Could be useful for some one. Here I capture only date from user and append either 00:00 hrs or 23:49 hrs using intervalds() and return to the parent rule. This requirement to apply filter on database column which is of type date and time.


    = with(
    /* ri!myDate is of type DATE */
    local!myDateFormatted: text(ri!myDate, "mm/dd/yyyy HH:mm z"),
    local!myDateSplit: split(split(split(local!myDateFormatted," "),"/"),":"),
    userdatetime(splitInt[3],splitInt[1],splitInt[2],splitInt[4],splitInt[5],"00")
    /*
    To add hours are minutes to reult intervalds() can be used
    userdatetime(splitInt[3],splitInt[1],splitInt[2],splitInt[4],splitInt[5],"00") + intervalds(23,49,0)
    */
    )
  • Sorry . .Correction ..

    = with(
    /* ri!myDate is of type DATE */
    local!myDateFormatted: text(ri!myDate, "mm/dd/yyyy HH:mm z"),
    local!myDateSplit: split(split(split(local!myDateFormatted," "),"/"),":"),
    userdatetime(local!myDateSplit[3],local!myDateSplit[1],local!myDateSplit[2],local!myDateSplit[4],local!myDateSplit[5],"00")
    /*
    To add hours are minutes to reult intervalds() can be used
    userdatetime(local!myDateSplit[3],local!myDateSplit[1],local!myDateSplit[2],local!myDateSplit[4],local!myDateSplit[5],"00") + intervalds(23,49,0)
    */
    )