In microsoft.public.scripting.vbscript message <OCtRm4ZBKHA.1488@xxxxxx
NGP03.phx.gbl>, Wed, 15 Jul 2009 15:46:52, Mark D. MacLachlan
<markdmac@xxxxxx> posted:
>
>One could grab the last day of the month in the following fashion:
>
>For M = 2 To 13
> If M < 13 Then
> FirstOfMonth = M & "/1/" & Year(Date)
> LastOfMonth = CDate(FirstOfMonth) -1
> WScript.Echo LastOfMonth
> Else
> LastOfMonth = "12/31/" & Year(Date)
> WScript.Echo LastOfMonth
> End IF
>Next
>
>There might be a more elegant way of doing that but that is what comes
>to my mind at the moment. There is. Perhaps you missed my microsoft.public.scripting.vbscript
message <W57ScIODO3UKFwCX@xxxxxx> of Tue, 7
Jul 2009 17:10:43. Consider it, sig, and :-
S = "<pre>"
for J = 1 to 16
S = S & J & " " & Day(DateSerial(2008, J+1, 0)) & VBCRLF
next
document.write S & "</pre>"
' It is convenient for me to write for a web page;
' changes for WSH should be easy enough. For full dates, omit Date().
Also, your way uses a vile FFF date string, and gives me the final date
in an alien format (my WinXP is set for ISO dates). That difference can
be avoided by changing one of your lines to
LastOfMonth = CDate("12/31/" & Year(Date))
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm estrdate.htm vb-dates.htm pas-time.htm critdate.htm etc.