• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help on cron expression

 
vivien siu
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need help on writing a cron expression that will fire at 3 days before the last day of each month. Which means, if the last day is 31st, it will fire at 28th. And if the last day is 28th, it will fire at 25th.

the following does not work at all:
0 0 1 L-3 * *
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try searching for "cron tutorial" with Google? This is what I found:

Newbie: Intro to cron
Cron Tutorial
Cron Tutorial. Cron, the linux event scheduler

etc.
 
vivien siu
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried, but they are normally done using intervals, which I think in my case, is impossible

if I want to do the same thing, but trying to check whether current date is 3 days before the last day of month in Java, how can I do that?
 
vivien siu
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
btw... something is wrong with my browser and it's causing multiple threads here, can Admin please help me lock the extras up? Thanks!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To find out if it is 3 days before the end of the month in Java, you could use the methods in java.util.Calendar.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic