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()))

Jeff
  • 8,020
  • 34
  • 99
  • 157

1 Answers1

7

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
  • 23,085
  • 14
  • 83
  • 107