Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


GrahamG
2009-01-26T12:00:53Z

Is this the correct way to calculate the last day of the prior month ?

{DATENOWADD(Days,-{DATEFORMAT(JulianYearDay)},yyyyMMdd )}


Thanks


Graham
Sponsor
Forum information
Support
2009-01-26T13:02:21Z
Are you thinking about last day as in 1 - 31?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
GrahamG
2009-01-26T13:05:41Z

31 - it's the last day of the prior month. As we are currently in Jan, the it would be the last day of Dec, which is 31.


Graham
Support
2009-01-26T13:09:27Z
Try this: {DATEADD(Days,{DATEFORMAT(yyyy-MM-01 HH:mm)},yyyy-MM-dd HH:mm,-1,dd)}

I am extracting the current year and month and explicitly set day 01. Then I am subtracting 1 day and formatting to "dd".
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2009-01-26T13:13:34Z
You can make this a bit shorter by removing HH:mm: {DATEADD(Days,{DATEFORMAT(yyyy-MM-01)},yyyy-MM-dd,-1,dd)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
GrahamG
2009-01-26T14:11:14Z
Hi support,

Aplogies, I misunderstood your question until I tested the result.

I need the output to be yyyymmdd which is the full date of the last day of the month.


Graham
Support
2009-01-26T14:17:11Z
Then you just change the format to this:

{DATEADD(Days,{DATEFORMAT(yyyy-MM-01)},yyyy-MM-dd,-1,yyyyMMdd)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top