Ive been searching through the forums, but have not come across the answer to this. On the first of every month, i need to run a report, two of the fields are date fields. the first one will be the first day of the month. the second field is the last day of the month. How can i make macro scheduler insert what the last day of the month is? Inserting the first day of the month is easy, since it is always the first, but since the last day can be the 28th, 29th, 30th, or 31st, im not sure how to insert the correct date.
any help would be greatly appreciated.
Thank you,
Joe
Insert Last Day Of Month
Moderators: Dorian (MJT support), JRL
There might be a more concise way to do this and you might want leading zeros on day and month.
Code: Select all
VBSTART
VBEND
Day>dd
Month>mm
Year>yyyy
VBEval>trim(%dd%),dd
VBEval>trim(%mm%),mm
Let>today=%mm%/%dd%/%yyyy%
Let>kk=
Repeat>kk
Add>today,1
Separate>today,/,var
If>var_1<>mm
Let>kk=done
Sub>today,1
EndIf
Until>kk,done
MDL>First day of the current month is: %mm%/1/%yyyy%%CRLF%Last day of the current month is: %today%
Here is another way to find last day of month
Here is another way to find the last day of the month
using VBScript.
Enjoy!
using VBScript.
Code: Select all
VBSTART
Function Last_Day_of_Month(mymonth)
Last_Day_of_Month = DateSerial(Year(Now), 1 + mymonth, 0)
End Function
VBEND
//Pass in the month number i.e. 1=January 2=February, etc
VBEval>Last_Day_of_Month(2),result
MessageModal>Last Day of Month = %result%