BASIC User Group > Code Challenges

Calculate week number

<< < (4/4)

John:
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.

AIR:

--- Quote from: John 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.

--- End quote ---

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

AIR.

John:
Sounds like a great plan.

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

John:
I would like to thank jalih for starting this challenge. A good challenge that ended up filling a hole in SB.

AIR:
MBC Version:


--- Code: Text ---$EXECON print "Today is: ", time$(FULLDATE), " and the Week Number is: ", time$(WEEKNUMBER) 
[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.

Navigation

[0] Message Index

[*] Previous page

Go to full version