Charmed Quark Systems, Ltd. - Support Forums and Community

Full Version: Week Number RTV
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need to use a week number in some logic and it is not available as a runtime variable.

Is there any chance we can get it added into the system?

Until then, any ideas on how to calculate the week number from date etc.

Thanks
Anything time related is tricky since it has to deal with leap this'es and that's. The week of the year isn't something available in my underlying C++ stuff either. If it doesn't have to be absolutely accurate, you can just get the Julian date for the 1st of Jan of the current year, then divide by 7. The current Julian date is available via action command but not the first of the year. You'd have to call CML to do that.

It would be something like:

1. Get current time stamp
2. Get it as individual time values
3. Leave the year value, but reset the month, day, hour, min, sec to indicate midnight the first of that year.
4. Set that back to to the time object
5. Get the Julian date from that
6. Get the current Julian date
7. Subtract the two then divide by seven