Hi,
I'm currently writing some code (some of you may have seen me ramble elsewhere about it) to provide more functions to works with dates other than just CurrentDate$ or manipulating dates yourself.
Firstly, what I'd really like to know ATM is how much interest there would be in me eventually making this into a module? - It's my intention is for it to be complete free.
Secondly are there any functions that you think I should include (if I can do it!) or any ideas you have as in to how it will work?
I have the following so far (copied from another thread)...
Cheers. :)
I'm currently writing some code (some of you may have seen me ramble elsewhere about it) to provide more functions to works with dates other than just CurrentDate$ or manipulating dates yourself.
Firstly, what I'd really like to know ATM is how much interest there would be in me eventually making this into a module? - It's my intention is for it to be complete free.
Secondly are there any functions that you think I should include (if I can do it!) or any ideas you have as in to how it will work?
I have the following so far (copied from another thread)...
All parameters in <> are optional.
If "datestring" is omitted then the system date is used.
If DD, MM and YYYY (where applicable) are all omited then the system date will be used.
Where appropriate leap years are tested/allowed for.
year% = date.Year(<"string">) ' returns year as a number from "string" - Used internally to get value from CurrentDate$
month% = date.Month(<"string">) ' returns month as a number from "string" - Used internally to get value from CurrentDate$
date% = date.Date(<"string">) ' returns day number of month as a number from "string" - Used internally to get value from CurrentDate$
lengthofmonth% = date.DaysPerMonth(<MM,YYYY>) ' returns number of days for month MM in year YYYY.
leapyear% = date.IsLeapYear(<YYYY>) ' returns True/False if year YYYY is leapyear or not.
dayofyear% = date.DayOfYear(<DD,MM,YYYY>) ' returns number of day in year starting at 1 for Jan 1st.
daystoyearend% = date.DaysToYearEnd(<DD,MM,YYYY>) ' returns number of days from date provided until end of that same year.
daycount% = date.DayCount(<DD,MM,YYYY>) ' returns a count of days using the Gregorian calender exclusively. Count starts with day 1 being 1-1-0001
daysbetween% = date.DaysBetween(fromDD, fromMM, fromYYYY, ToDD, ToMM, ToYYYY) ' returns count of days between two dates. I'm liable to drop this method as it's just as simple to use DayCount(<1st Date>)-DayCount(<2nd Date>)
dayname$ = date.DayName(<DD, MM, YYYY, True/False>) ' returns day name (mon, tues) etc. from date given. Optional parameter (True) returns long day name e.g. Monday. Default (False) returns short day name e.g. Mon
Also planned...
weeknum% = date.WeekNumber(<DD, MM, YYYY, OFFSET>) ' returns week number 1-52 for given date. Not decided whether or not to bother with the OFFSET parameter yet - might be over-kill. This is currently in progess and going slow - but I'm getting there. :)
datestring$ = date.Format(DateCountValue, <"string formatting parameters">) ' return a user defined date string from the DateCounter value. i.e. give user freedom to return date the way they want, e.g. Sat, 20-May-2006 or Saturday - 20/5/2006 etc.
Really not looked at this last one very much yet and it will be left until last as it's possibly the most challenging part. :)
No doubt I've forgotten something there, but you get the idea I hope. Then end idea is to have all that functionality and make this into a Module so these methods all become commands within BM. Mind you I have to suss out how to make Modules yet as well LOL. :)
If "datestring" is omitted then the system date is used.
If DD, MM and YYYY (where applicable) are all omited then the system date will be used.
Where appropriate leap years are tested/allowed for.
year% = date.Year(<"string">) ' returns year as a number from "string" - Used internally to get value from CurrentDate$
month% = date.Month(<"string">) ' returns month as a number from "string" - Used internally to get value from CurrentDate$
date% = date.Date(<"string">) ' returns day number of month as a number from "string" - Used internally to get value from CurrentDate$
lengthofmonth% = date.DaysPerMonth(<MM,YYYY>) ' returns number of days for month MM in year YYYY.
leapyear% = date.IsLeapYear(<YYYY>) ' returns True/False if year YYYY is leapyear or not.
dayofyear% = date.DayOfYear(<DD,MM,YYYY>) ' returns number of day in year starting at 1 for Jan 1st.
daystoyearend% = date.DaysToYearEnd(<DD,MM,YYYY>) ' returns number of days from date provided until end of that same year.
daycount% = date.DayCount(<DD,MM,YYYY>) ' returns a count of days using the Gregorian calender exclusively. Count starts with day 1 being 1-1-0001
daysbetween% = date.DaysBetween(fromDD, fromMM, fromYYYY, ToDD, ToMM, ToYYYY) ' returns count of days between two dates. I'm liable to drop this method as it's just as simple to use DayCount(<1st Date>)-DayCount(<2nd Date>)
dayname$ = date.DayName(<DD, MM, YYYY, True/False>) ' returns day name (mon, tues) etc. from date given. Optional parameter (True) returns long day name e.g. Monday. Default (False) returns short day name e.g. Mon
Also planned...
weeknum% = date.WeekNumber(<DD, MM, YYYY, OFFSET>) ' returns week number 1-52 for given date. Not decided whether or not to bother with the OFFSET parameter yet - might be over-kill. This is currently in progess and going slow - but I'm getting there. :)
datestring$ = date.Format(DateCountValue, <"string formatting parameters">) ' return a user defined date string from the DateCounter value. i.e. give user freedom to return date the way they want, e.g. Sat, 20-May-2006 or Saturday - 20/5/2006 etc.
Really not looked at this last one very much yet and it will be left until last as it's possibly the most challenging part. :)
No doubt I've forgotten something there, but you get the idea I hope. Then end idea is to have all that functionality and make this into a Module so these methods all become commands within BM. Mind you I have to suss out how to make Modules yet as well LOL. :)
Cheers. :)