Genesys Cloud - Main

 View Only

Sign Up

Expand all | Collapse all

Convert date format that comes from slot builtin:date

  Thread closed by the administrator, not accepting new replies.
  • 1.  Convert date format that comes from slot builtin:date

    Posted 11-03-2022 10:55
    No replies, thread closed.
    Next question :-)  I collect date of birth in a voice bot and it appears as e.g. 1980-01-21 in a call script. How can i convert this date format that it appears as 21.01.1980? I would rather do it in the flow than in the script.
    #ArchitectureandDesign

    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------


  • 2.  RE: Convert date format that comes from slot builtin:date

    Posted 11-04-2022 23:15
    No replies, thread closed.
    If you are getting a date format, you can use Append(Day(datetimevariable), ".", Month(datetimevariable), ".", Year(datetimevariable)) to create a string with that format.  If all you are getting is a string, you will need to convert that string to a datetime type using MakeDate(datetimevariable).  Again, you might have to break the string down for the MakeDate to work.

    ------------------------------
    Robert Wakefield-Carl
    Avtex Solutions, LLC
    Contact Center Innovation Architect
    https://www.Avtex.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 3.  RE: Convert date format that comes from slot builtin:date

    Posted 11-07-2022 09:18
    Edited by Thomas Repking 11-07-2022 09:24
    No replies, thread closed.
    Hi Robert, thank you. I could not figure it out and It seems to me the problem is that the slot result in the bot is date and the outputs in the call bot action are all string and I can´t change it to anything else then string. I don´t know how to make that matching. 





    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------



  • 4.  RE: Convert date format that comes from slot builtin:date

    Posted 11-07-2022 14:48
    No replies, thread closed.
    You will need to setup your own string variable to do that conversion, and then set that new variable as an output, and then you can access it like any other output in the calling flow.

    ------------------------------
    Anton Vroon
    ------------------------------



  • 5.  RE: Convert date format that comes from slot builtin:date

    Posted 11-08-2022 02:58
    No replies, thread closed.
    Hello Anton, thank you for your answer. I don't want to burden you too much, but would it be possible for you to show me how the variable has to be written so that it works as well as the built-in one?

    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------



  • 6.  RE: Convert date format that comes from slot builtin:date

    Posted 11-08-2022 11:28
    No replies, thread closed.
    On the Append statement, include ToString for each:
    Append(ToString(Day(Geburstdatum)), ".", etc.

    That should get you to the correct string that you can then output to your messaging flow.

    ------------------------------
    Robert Wakefield-Carl
    Avtex Solutions, LLC
    Contact Center Innovation Architect
    https://www.Avtex.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 7.  RE: Convert date format that comes from slot builtin:date

    Posted 11-08-2022 14:06
    No replies, thread closed.
    Its just as Robert said, but here is the steps if it helps
    Start with your date slot like so

    Then Create your string variable like so
    The expression would look like this
    Append(ToString(Day(Slot.StartDate)), ".", ToString(Month(Slot.StartDate)), ".", ToString(Year(Slot.StartDate)))

    Click on the variable name and set it to Output from Flow 


    And now it in the calling flow you will see it under outputs just like the slots.

    ------------------------------
    Anton Vroon
    ------------------------------



  • 8.  RE: Convert date format that comes from slot builtin:date

    Posted 11-09-2022 02:43
    Edited by Thomas Repking 11-09-2022 02:43
    No replies, thread closed.
    Thank you so much, Anton and Robert!!



    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------



  • 9.  RE: Convert date format that comes from slot builtin:date

    Posted 11-10-2022 02:05
    No replies, thread closed.
    One last question about this. How do I have to proceed if I want to display for example the date from my last screenshot as 14.06.1975 instead of 14.6.1975?

    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------



  • 10.  RE: Convert date format that comes from slot builtin:date

    Posted 11-10-2022 05:19
    No replies, thread closed.
    There are a few ways to do it, you can for example do it the same time you're appending the date

    Append(
    	If(
    		Day(Flow.Date) > 9,
    			ToString(Day(Flow.Date)),
    			Append( "0", ToString(Day(Flow.Date)))
    	), 
    	If(
    		Month(Flow.Date) > 9,
    			ToString(Month(Flow.Date)),
    			Append( "0", ToString(Month(Flow.Date)))
    	),
    	ToString(Year(Flow.Date))
    )
    ​


    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 11.  RE: Convert date format that comes from slot builtin:date

    Posted 11-10-2022 09:58
    No replies, thread closed.
    Thank you Jan, works and helps me to understand the logic behind it a little bit better.

    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------