# I'll Gladly Pay You Tuesday for a Hamburger Today

My day job pays me on the 15th and last day of every month, unless those days land on a weekend, in which case I get paid the Friday before. With those rules, creating a Google Calendar event is shockingly difficult. In fact, it's not possible to create a recurring event with those rules using Google's GUI scheduling tool.

Thankfully, you can import an event from an .ical file, and Google will understand the more complex schedules. In my case, I needed two separate events. For the 15th of every month, with weekends being paid on Friday, here is the .ical file:

``````
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20170101
DTEND:20170101
RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=14
RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYMONTHDAY=15
SUMMARY: Get Paid
END:VEVENT
END:VCALENDAR
```
```

The `DTSTART` and `DTEND` dates are set to when you first want the recurring event to start. I just started on January 1, 2017. If you read through the logic, basically the event is placed on Friday if Friday is the 13th, on Friday if Friday is the 14th and on any weekday that lands on the 15th. The rules are evaluated in order, so if Friday is the 13th or 14th, the event is scheduled then.

The last day of the month except for weekends was actually a bit more complicated, but still doable. That event looks like this:

``````
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20170101
DTEND:20170101
RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1;WKST=MO;
SUMMARY: Get Paid
END:VEVENT
END:VCALENDAR
```
```

The logic is a little harder to follow, and I actually had to adapt a post on Stack Overflow to get it to work. They both seem to work flawlessly, so I'm not complaining.

In order to add them to your calendar, you just save two text files with the above text. I'm not sure if the .ical extension is required, but that's the type of file it is, so I recommend using it. Then you "import" a calendar, and you'll be asked to which calendar to add the event. Unfortunately, if you need to make a change to the schedule, you'll have to delete the event and re-create/import it, because it can't be adjusted with the Google GUI. But, the whole point was to have the date figured out so I wouldn't have to edit it anymore.

Shawn is Associate Editor here at Linux Journal, and has been around Linux since the beginning. He has a passion for open source, and he loves to teach. He also drinks too much coffee, which often shows in his writing. You can contact Shawn via e-mail, ljeditor@linuxjournal.com.

## Topic of the Week

Cloud

The cloud has become synonymous with all things data storage. It additionally equates to the many web-centric services accessing that same back-end data storage, but the term also has evolved to mean so much more.

by Petros Koutoupis
by Corey Quinn
by Kyle Rankin
by Marco Fioretti
by John S. Tonello