Convert text data to text formatted data

Certified Associate Developer

Hello 

how to convert this text string: "2022-11-12 00:00:00"(Text)

to text string in format "dd/MM/yyyy" ?

Thank you!. 

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    Hi Vladimir,

    Please use the following code to convert the given text string to date time format

    a!localVariables(
    local!myDate:"2022-11-12 00:00:00",
    local!splitDate:fn!split(local!myDate,"-"),
    local!splitDay:fn!split(local!splitDate[3]," "),
    local!splitTime:fn!split(local!splitDay[2],":"),
    local!dateTime:fn!datetime(
    local!splitDate[1],local!splitDate[2],local!splitDay[1],
    local!splitTime[1],local!splitTime[2],local!splitTime[3]
    ),
    fn!todate(local!dateTime)
    )

    After that you can either use todate() or text() function for display purposes.

Reply
  • +1
    Certified Lead Developer

    Hi Vladimir,

    Please use the following code to convert the given text string to date time format

    a!localVariables(
    local!myDate:"2022-11-12 00:00:00",
    local!splitDate:fn!split(local!myDate,"-"),
    local!splitDay:fn!split(local!splitDate[3]," "),
    local!splitTime:fn!split(local!splitDay[2],":"),
    local!dateTime:fn!datetime(
    local!splitDate[1],local!splitDate[2],local!splitDay[1],
    local!splitTime[1],local!splitTime[2],local!splitTime[3]
    ),
    fn!todate(local!dateTime)
    )

    After that you can either use todate() or text() function for display purposes.

Children
No Data