cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert user response date to text date month and year???

0 Kudos

Hi!

I have a syntax that brings on the date to and from , from the user response as a complete date in MM/dd/yyyy format. I would like to display the date in the format with the month name instead of the date format.

Currently based on the syntax that I have below :

="Incident Date Range: "+ Replace(Replace(UserResponse("Incident Date Range");"12:00:00 AM";"");";";"-")

I get the date as "Incident date Range : 3/13/2017 - 3/19/2017". I would like to see the date as " "Incident date Range: March 13 To March 19".

Is it possible to do so and if so , what should the modification be on my syntax above.

help will be greatly appreciated.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

mhmohammed
Active Contributor
0 Kudos

Hi Sumit,

Try to create the below variables, I'm leveraging the work you already did.

v_Date Range = Replace(Replace(UserResponse("Incident Date Range");"12:00:00 AM";"");";";"-")

This will give you the result as 3/13/2017 - 3/19/2017, per what you wrote above.

v_Start Date =FormatDate(Todate(Substr([v_Date Range];1;Pos([v_Date Range];" ")-1));"");"Mmmm d") (use dd if you want to see 2 digits for dates 01,02,03,..,09)

v_End Date =FormatDate(Todate(Substr([v_Date Range];Pos([v_Date Range];"-")+2;Length([v_Date Range]));"");"Mmmm d")

v_Final Date Range = [v_Start Date]+" - "+[v_End Date]

Hope that helps!

Thanks,
Mahboob Mohammed

amitrathi239
Active Contributor
0 Kudos

follow these steps.

Assuming you are getting "3/13/2017 12:00:00 AM;3/19/2017 12:00:00 AM" values in the user response function.

Create =DateUserResponse("Incident Date Range")

First date=FormatDate(ToDate(Left([Date];Pos([Date];";")-1);"MM/dd/yyyy hh:mm:ss A");"Mmmm dd")

Second date=FormatDate(ToDate(Right([Date];Pos([Date];";")-1);"MM/dd/yyyy hh:mm:ss A");"Mmmm dd")

Final variable="Incident Date Range: " +FormatDate(ToDate(Left([Date];Pos([Date];";")-1);"MM/dd/yyyy hh:mm:ss A");"Mmmm dd")+ " to "+FormatDate(ToDate(Right([Date];Pos([Date];";")-1);"MM/dd/yyyy hh:mm:ss A");"Mmmm dd")