Author Topic: Calculate week number  (Read 8509 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: Calculate week number
« Reply #15 on: November 07, 2018, 10:05:07 AM »
There was no WEEKNUM option in the FORMATDATE() function docs. I even looked at the SB source. I was really surprised Peter missed it.

Obviously NOT.

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Calculate week number
« Reply #16 on: November 07, 2018, 10:11:24 AM »
There was no WEEKNUM option in the FORMATDATE() function docs. I even looked at the SB source. I was really surprised Peter missed it.

Obviously NOT.

Right, there wasn't.  I added it.  Check your PM...

AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: Calculate week number
« Reply #17 on: November 07, 2018, 11:38:33 AM »
Sounds like a great plan.

I can't thank you enough for all your efforts. You breath life into everything you do.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: Calculate week number
« Reply #18 on: November 07, 2018, 12:38:42 PM »
I would like to thank jalih for starting this challenge. A good challenge that ended up filling a hole in SB.

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Calculate week number
« Reply #19 on: December 13, 2018, 04:09:58 PM »
MBC Version:

Code: Text
  1. $EXECON
  2.  
  3. print "Today is: ", time$(FULLDATE), " and the Week Number is: ", time$(WEEKNUMBER)
  4.  

[riveraa@MPD ~/Projects/mbc] $ ./datetest
Today is: Thursday, December 13, 2018 and the Week Number is: 50
[riveraa@MPD ~/Projects/mbc] $



I'm going to add NAMED PARAMETERS so that you don't need to look up what each number fed to TIME$() represents....

Added (code updated above).

Options are:

  TIME - HH:MM:SS,
  HOUR - HH,
  MINUTE - MM,
  SECOND - SS,
  APM - AM/PM,
  YEAR - YYYY,
  MONTH - MONTH NUMBER,
  DAY - DAY NUMBER,
  DAYNAME - NAME OF DAY,
  WEEKDAY - NUMBER OF DAY IN WEEK ,
  YEARDAY - NUMBER OF DAY IN YEAR,
  WEEKNUMBER - NUMBER OF WEEK IN YEAR,
  DATE - MONTH/DAY/SHORT YEAR,
  FULLDATE - NAME OF DAY, NAME OF MONTH, DAY, FULL YEAR


All are based on current date.



AIR.
« Last Edit: December 13, 2018, 05:03:40 PM by AIR »