Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Week Number RTV
#1
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
Mykel Koblenz
Illawarra Smart Home
Reply
#2
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
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Generate Random Number in a Trigger batwater 1 1,714 12-10-2017, 12:43 PM
Last Post: Dean Roddey
  Correspond image to number? jkmonroe 1 1,971 02-07-2015, 08:10 PM
Last Post: Dean Roddey
  vBulletin getting excess number of access violations Mark Stega 3 2,614 06-20-2014, 08:49 AM
Last Post: Dean Roddey
  Displaying slot number diy8888 18 7,096 05-19-2014, 05:22 AM
Last Post: Dean Roddey
  Not a Valid Zone Number for Blaster Jnetto 21 7,991 12-24-2013, 03:51 PM
Last Post: Dean Roddey
  Conver text to number? jpants 3 2,115 03-16-2010, 10:47 AM
Last Post: Dean Roddey
  Converting number of seconds to Hours:Minutes:Seconds electron 38 11,715 03-08-2010, 10:49 AM
Last Post: Dean Roddey
  Exception message line number beelzerob 10 3,504 06-23-2008, 07:33 AM
Last Post: beelzerob
  Current Page number for CAB? Squintz 8 2,498 03-04-2008, 10:18 AM
Last Post: ellisr63
  Number of records returned by DBStatement jrlewis 1 1,540 09-04-2007, 09:33 AM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)