Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

help on cron expression  RSS feed

 
Ranch Hand
Posts: 143
  • 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 * *
 
Java Cowboy
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • 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
  • 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
  • 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
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • 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.
 
The only cure for that is hours of television radiation. And this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!