last day(#) of month

Discuss RoboTask here
Post Reply
patelxyz
Posts: 6
Joined: Fri Oct 07, 2005 8:40 am
Location: United States

last day(#) of month

Post by patelxyz »

How can I create a variable to set a last day of last month. I need to change file name from "current file" to "new file name_ 02-28-2011".
Any help is appreciated
Oleg
Site Admin
Posts: 3201
Joined: Thu Jan 01, 1970 1:00 am
Contact:

last day(#) of month

Post by Oleg »

I think you can do this with BASIC.
In order to calculate last date in previous month you should subtract 1 from 1-st date of current month.

Basic expression:
DateSerial(Year(Date), Month(date),1) - 1

Also see this example

This task requires Basic plugin. You can download it here.
rknight10
Posts: 3
Joined: Tue Mar 22, 2011 12:41 pm
Location: United States

last day(#) of month

Post by rknight10 »

That works great!
I needed the month code to always be 2 chars long. (Leading zero if needed) So I added:
Right("0" & cstr(month(Date)-1),2)
I share this in case it helps someone.
Thanks,
Rob
Post Reply