- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 04:58 AM
Hi All,
I need to create a scheduled job for a task to generate on the first Friday of each month. I have seen similar question but I have one problem - I cannot specify the name of the day when the job will be running, only day numbers are available. Could you please advise me how to deal with it?
Thanks,
Martyna
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 05:20 AM - edited 10-13-2023 05:44 AM
Hi @Martyna
You can use this:
answer = isFirstFridayOfMonth();
function isFirstFridayOfMonth() {
// Get the current date
const currentDate = new Date();
// Get the first day of the month
const firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
// Check if the current day is a Friday
const isFriday = currentDate.getDay() === 5;
// Check if the current day is the first Friday of the month
const isFirstFridayOfMonth = isFriday && firstDayOfMonth.getDay() === 5;
return isFirstFridayOfMonth;
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 05:39 AM
Hi @Martyna ,
Use this in the condition of scheduled job:
answer = (new Date().getDay() == 5) && (new Date().getDate() <=7);
Regards,
Piyush Sain

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 05:20 AM - edited 10-13-2023 05:44 AM
Hi @Martyna
You can use this:
answer = isFirstFridayOfMonth();
function isFirstFridayOfMonth() {
// Get the current date
const currentDate = new Date();
// Get the first day of the month
const firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
// Check if the current day is a Friday
const isFriday = currentDate.getDay() === 5;
// Check if the current day is the first Friday of the month
const isFirstFridayOfMonth = isFriday && firstDayOfMonth.getDay() === 5;
return isFirstFridayOfMonth;
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 05:35 AM
Thank you Peter!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 05:40 AM
@Martyna This code will work on any Friday of the Month, not the first Friday
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 05:39 AM
Hi @Martyna ,
Use this in the condition of scheduled job:
answer = (new Date().getDay() == 5) && (new Date().getDate() <=7);
Regards,
Piyush Sain