date prompt format error

Hello I am trying to capture the date from a date prompt, but the following returns the wrong date.


=(ToDate(UserResponse("Please Enter As Of Date:");"mm/dd/yyyy hh:mm:ss a"))

When a user runs “03/31/2004 12:00:00 am” the results of the above return 12/31/2004. Any thoughts on what I am doing wrong?

It appears that the todate function is not working properly.


zamboni95 (BOB member since 2004-04-07)

Did you try AM/PM at the end of the format instead of a?


Randy Jones :us: (BOB member since 2002-08-19)

Figured it out. Here’s the solution


=(ToDate(UserResponse("Please Enter As Of Date:");"MM/dd/yyyy hh:mm:ss a")) 

Notice that the placeholders for the month need to be capitalized.


zamboni95 (BOB member since 2004-04-07)

Absolutely true. I struggled for a couple of days to convert that string to a data, and heck no. It was giving me #ERROR. Thanks for the enlightment. BO document is useless.


shesur (BOB member since 2004-08-26)