2

The method should retrieve the date in the previous week that corresponds most closely to the specified date.

fromdate = prevMth(systemDateGet());

need to change the above code so that i could get the date of the previous week instead of previous month with respect to the present date.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
mepemba
  • 39
  • 1
  • 4

2 Answers2

2

No function is needed, just use date arithmetic.

systemDateGet() - 7

This will return the prior week date. This of cause implies you use a calendar with 7 day weeks.

Some additional things you may find useful:

  • wkOfYr(...)
  • dayOfWk(...)
  • DateTimeUtil::[VariousFunctionsHere]
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
0

In D365FinOps you can also use:

HcmDateTimeUtil::calculateDateWithOffset(PeriodUnit::Day,7,false)
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77