-1

I have string like "July 24 2015" is it possible to convert this to date(TS) data type?

it would convert to something like mm/dd/YYYY "07/24/2015 00:00:00.000"

Can I do that with progress 4GL?

thank you

BobNoobGuy
  • 1,551
  • 2
  • 30
  • 62

2 Answers2

3
define variable inputString as character no-undo.
define variable monthList   as character no-undo.

monthList = "January,February,March,April,May,June,July,August,September,October,November,December".

update inputString format "x(30)".

display datetime( date(
  lookup(  entry( 1, inputString, " " ), monthList ),
  integer( entry( 2, inputString, " " )),
  integer( entry( 3, inputString, " " ))
)).
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
0
Thank you for the code. 
A different version. 
define variable inputString as character no-undo.
define variable monthList   as character no-undo.

monthList = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".

//update inputString format "x(30)".
inputString = "17-Aug-2022".


display datetime( date(
  lookup(  entry( 2, inputString, "-" ), monthList ),
  integer( entry( 1, inputString, "-" )),
  integer( entry( 3, inputString, "-" ))
)).