Jump to content

Recommended Posts

Posted (edited)
Since you didn't specify a specific AD PLC I won't give actual code. But I assume you at least have a real time clock which gives at least 'year (00-99)', 'month (1 - 12)' and 'day of month (1 - ??) Set up a table of 11 entries with the days in a month (show February as 28). You don't need an entry for December. 'Day of Year' = 0 If Month > 1 then For X = 1 to (Month - 1) 'Day Of Year' = 'Day Of Year' + table[X] Next X End If 'Day Of Year' = 'Day Of Year" + 'Day Of Month' If MOD(Year /4) = 0 AND Month > 2 then 'Day Of Year' = 'Day Of Year' + 1 End If Now - translate that into code of your target PLC. Since the Leap Year test works from 1901 through 2099 if figured that it is detailed enough. Edited by b_carlton

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...