Question
· Jan 17, 2018

How do i get the fist day of every month in objective scripting

 the start date must always
be the first day of the effective salary month.
 

Discussion (5)1
Log in or sign up to continue

If you substract the current day-of-the month from the current date in $horolog format, you will end up with the first day of the current month in $horolog format :

Write $horolog - $zdate($horolog, 4) + 1

If your date is in another format, convert it using $zdateh/$zdate, see also :

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

and

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

Just a hint, I would take $ZD($h,2). For today, my development system (and systems at customers site) shows:

Write $horolog - $zdate($horolog, 4) + 1 --> 65925.93
Write $zdate($horolog,4) --> 20.07.2021
Write $horolog - $zdate($horolog, 2) + 1  --> 65926 // expected value

Later, this value (65925.93), as a $zdate() argument,  gives you an <ILLEGAL VALUE> 

For $zdate($horolog,4), the link you provided says:

4 DD/MM/[YY]YY (01/07/97 or 27/03/2002) — European numeric format. You must specify the correct dateseparator character (/ or .) for the current locale.