views:

754

answers:

1

How do I subtract 30 days from a date in PowerBuilder?

I have the following code that returns today's date in a parameter, but I need today - 30 days:

dw_1.setitem(1, "begin_datetime", datetime(today(), Now()))

+5  A: 

you're probably looking for the RelativeDate function. Unfortunately, it takes a Date and not a DateTime as a parameter, but we can get around that:

dw_1.setItem(1, "begin_datetime", DateTime( RelativeDate( today(), -30), Now() )
ninesided