How to Calculate the First Monday of the Month Using RSLogix and Rockwells UFDB

Question:

Hello everyone, I'm seeking assistance in determining the date of the first Monday of the month. Has anyone else tackled this type of calculation before? I've heard that Rockwell's UFDB can accurately compute the day of the week.

Top Replies

**Calculating the First Monday of the Month: Seeking Assistance** Hello everyone! I'm reaching out for assistance in determining the first Monday of the month. Has anyone else tackled this type of calculation? I know that Rockwell offers the UFDB, which can compute the Day of the Week. Please feel free to expand on this topic. I might be misinterpreting the question, but here’s my attempt: When utilizing the GSV function to retrieve the current date and time, it's stored in an array of DINTs. I refer to my array as PLC_DateTime, where index 0 represents the year, index 1 the month, and index 2 the day. Can someone guide me on how to use this data to identify the first Monday? I appreciate any insights you can share!

To accomplish this task, you can implement a simple code snippet incorporating the following elements: - Day of the week - Day of the month - A tracking mechanism for new month identification As soon as you transition into a new month, activate the New Month tracking indicator and start searching for Monday. This method should streamline your weekly scheduling process effectively.

I believe you might not require the tracking feature, since the first Monday or any weekday will always take place by the 7th day of the month.

User "thingstodo" expressed a concern: "I believe I may be misinterpreting the question, but let me give it a shot. When utilizing the GSV (Get System Value) to extract the date and time into an array of dints, I refer to my array as PLC_DateTime. In this setup, index 0 represents the year, index 1 signifies the month, and index 2 indicates the day. Additionally, I have configured an EQU (equate) for PLC_DateTime[2] to trigger a First_Day_Oneshot with Your_New_Tag. I must admit, I realized that I had not fully grasped the question—why is it that we can't recognize these misunderstandings before clicking 'SUBMIT'?"

I would consider only two specific criteria: First, if the day of the week is Monday (this routine is already established), and second, if the date of the month is 6 or earlier (this information is straightforward to obtain). When both of these conditions are met, it indicates that it is the first Monday of the month.

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.

Frequently Asked Questions (FAQ)

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’