Prabu Karana
Prabu Karana

Reputation: 302

How to add string to date function - Progress 4gl

I am newbie in Progress and I've Trouble in date function Progress 4gl.

Example I have string value = '2016 '.

How do I put that value into a date in Progress?

Example:

def var xx as char.
def var xq as date.

ASSIGN 
  xx = '2016'
  xq = DATE(01/01/xx).

Upvotes: 2

Views: 2000

Answers (1)

idspispopd
idspispopd

Reputation: 404

While it is possible to write

ASSIGN 
  xx = '2016':U
  xq = DATE('01/01/':U + xx)
.

I would prefer

ASSIGN 
  xx = '2016':U
  xq = DATE(1,1,integer(xx))
.

(The first example is dependent on the current date format. If you look up the DATE function in the OpenEdge Help you can see that DATE ( month, day, year ) is valid, too.)

Upvotes: 4

Related Questions