MonthName and DayName commands

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

MonthName and DayName commands

Post by Methuselah » Wed Apr 06, 2005 1:03 pm

A Trivial suggestion:

I've noticed a common section of VBScript that I'm copying into a large number of my macros ... a function to return the full (text) name of the month in question. Perhaps it may benefit other users to expose some of the VBScript functionality as MacroScript commands.


At present (VBScript function excluded) it looks like this ...

VBEval>GetMonthName("%Which_Date%"),MMM


Perhaps a FullMonth or MonthString command could be added.

1. Must not conflict with existing Month (MON) command.
(This returns the current month number)


2. Should return the [English] month name, e.g. "August"
Return should be in correct (proper) case.

(I have not thought about how this would affect internationalisation)
(Perhaps a configuration option ... allowing the user to specify values)
(e.g. Tools, options MonthName strings)
(Hmmnn ... but that opens a whole new kettle of fish !)


3. Should accept the relative month to be returned.
Why ? Often I need to determine the text of last month
This to build up a filename. e.g Stats_Mar04.xls


Proposed example call :-

Month>the_month
FullMonthName>%the_month%,MonthName
MidStr>MonthName,1,3,MMM
Let>FileName=Stats_%MMM%%YY%.xls


~~~~~~~~~~~
While we're at it, how about a weekday name command as well ?


Even better would be to pass a DATE to these functions. GetDD("%Which_Date%"),DD

// VBS function to return last two digits of year
VBEval>GetYY("%Which_Date%"),YY


// MSched functions (now) handle the rest
FullDayName>%Which_Date%,DayName
MidStr>DayName,1,3,DDD

FullMonthName>%Which_Date%,MonthName
MidStr>MonthName,1,3,MMM


Let>FileName=Stats_%DDD%%DD%%MMM%%YY%.xls

(Resulting in "Stats_Wed_02Mar05.xls" )


My two cents ;-)

Robin.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts