Sign in to follow this  
Followers 0
simon Ong SK

How to Check This Date fall within which Week

26 posts in this topic

Hi guys: Does anyone program this Before? Read the Calender (AR352 to AR356, I'm using CJ) then determined which week the date belong to? Example Jan 3 is in Week 1 and 5 Feb in Week 6 and it automatically adjust when the year changes. Please help Thanks

Share this post


Link to post
Share on other sites
I have never done this but have had to calculate the day of the week. The week number is usually an intermediate step to this process. You may take a look at Sleepy Wombat's code HERE and see if you can modify it to do the week. It may be a good starting point

Share this post


Link to post
Share on other sites
Have never done it myself but I think you should be able to turn these formulas into logic using the available date & time info from the clock AR area. P.S. If you happen to work with A/B SLC, you can have a look at this code.

Share this post


Link to post
Share on other sites
Thanks for the Tips. TW: The Wombat code format is CXF, I'm using CX one, I could not Import or Open it. What Should I Do?

Share this post


Link to post
Share on other sites
Can't help you on that. Wait for Sleepy to wake up, PDL or on of the others that are good at Omron to come back. I'm just learning Omron too

Share this post


Link to post
Share on other sites
CXF is function block file format. Import like this. p.s. Wombat code ? Cool ! .... what is it ?

Share this post


Link to post
Share on other sites
The "Wombat" code. I developed the folowing function blocks for calc of day light saving time..... FB Calc Day of the week FB Extract Time Date into Sec,Min, Hr, Day, Mth, Yr FB Day light savings function block

Share this post


Link to post
Share on other sites
Ahh right... missed TW post. Thanks Sleepy!

Share this post


Link to post
Share on other sites
Had a client recently wanted me to code daylight savings time - OK if it does not vary from year to year. The best one was they wanted me to code PUBLIC HOLIDAYS!!!!. Good one when Easter, for example, is different every year, and some others. Could slways code in the moon quarters etc I suppose and calculate from that. Edited by BobB

Share this post


Link to post
Share on other sites
Here's some math behind calculating Easter Bob... Calculate Easter math

Share this post


Link to post
Share on other sites
Thanks Sleepy!! I will put that amongst my list of least usefull websites!!

Share this post


Link to post
Share on other sites
Did you program in this long weekend public hol Bob....

Share this post


Link to post
Share on other sites
Sleepy, the message they got was ring me on Friday and I will program out Monday then ring me on Tuesday and I will program Monday back in. Minimum charge per day $500.

Share this post


Link to post
Share on other sites
For 3 hours max? Edited by BobB

Share this post


Link to post
Share on other sites
My solution would be to add a list of days during holiday time, then come and fix (update) that once a year or something. Max 30 minutes of work per year, far easier to program than a generic algorithm (which you'll have to change when politicians change the holidays)

Share this post


Link to post
Share on other sites
Even better, let them set the holidays themselves through a SCADA or HMI if its available. Something like 30 entries with checkboxes if they should be accounted as holidays or not. .... Or is that what people mean with if you automate everythting you lose your job

Share this post


Link to post
Share on other sites
SCADA? That would be nice. HMI? They have an NT600S and it took half a day to train them how to look up alarms from flashing push buttons. By the way, the reason they have the old 600S is that it can be seen very clearly from a distance (electroluminescent).

Share this post


Link to post
Share on other sites
The Wombat Code, it has a good ring to it. I will have to remember to refer to Sleepy's samples as that from now on

Share this post


Link to post
Share on other sites
Hey I said it had a nice ring to it, didn't say anything about the looks of it

Share this post


Link to post
Share on other sites
hi there, I am from Spain, i need to do the syncronization of 13 CJ1M cpu12 plcs and one PC.(ethernet) I do it with the sntp server but it doesn´t work because of day light savings. how can i do completely automatic syncronization? any idea? thank you very much, Alberto

Share this post


Link to post
Share on other sites
Welcome the the forum Alberto You might want to start a new thread about time sychronization so you will get more answers TW

Share this post


Link to post
Share on other sites
Wombat code?....Is that like the DaVinci Code?

Share this post


Link to post
Share on other sites
No, the Wombat Code is similar the the Anthony Code. No one is sure where it came from. It is so advanced that some feel it may have came from aliens. Others have introduced scientific evidence that theorizes that it came from a forum called MrPLC. But the same as the crop circles of England, most say it is not humanly possible

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0