Topic: Determination of number of days in a month (VBS)

Hello
how it is possible on VBS to define number of days in specific month of specific year?

Re: Determination of number of days in a month (VBS)

``````s_year = 2000
s_month = 2
MsgBox Day (DateAdd ("d",-1, DateSerial (s_year, s_month + 1, 1)))``````

Re: Determination of number of days in a month (VBS)

Even is easier

``MsgBox Day (DateSerial (s_year, s_month + 1, 0))``

Re: Determination of number of days in a month (VBS)

Shocker. Pro wrote:

even is easier

``MsgBox Day (DateSerial (s_year, s_month + 1, 0))``

the trick with the last zero, did not know

Re: Determination of number of days in a month (VBS)

big-duke wrote:

Nichose the trick with the last zero, did not know

aha, too did not know to a pore, as arguments for DateSerial it is possible to write that got, for example 13th month is a January next year, it is possible to set the negative values also

Re: Determination of number of days in a month (VBS)

For the sake of interest, found an initial topic. It is Misha of an eye opened. Also that you would think, a topic... About an amount of days in a month ))
http://www.sql.ru/forum/751086/pomogite … dateserial

Re: Determination of number of days in a month (VBS)

Shocker. Pro, I THANK!
Prompt please still how to transform a title of month to its number?

Re: Determination of number of days in a month (VBS)

In what language the title of month will be written, and whether regional settings Windows will certainly coincide with this language?

Re: Determination of number of days in a month (VBS)

Shocker. Pro, the title of month is written in RUSSIAN
The regional coincide

Re: Determination of number of days in a month (VBS)

PUT_2012;
And a title short -  or long - January?

Re: Determination of number of days in a month (VBS)

``````s_month = "February"
MsgBox Month (CDate ("1" BOTH s_month AND "-2000"))``````

Re: Determination of number of days in a month (VBS)

PUT_2012;

``````Sub GetDateFromStr_RU ()
Dim sSource As String
Dim lM As Long
sSource = "on April, 16th 1999"
lM = Val (InStr (1, "", Mid (sSource, InStr (1, sSource, "", 1) + 1, 3), 1) + 2) / 3
MsgBox DateSerial (Right (sSource, 4), lM, Left (sSource, 2))
End Sub``````

But the date format always should be as above with a year from 4 digits. Otherwise it is necessary .

Re: Determination of number of days in a month (VBS)

big-duke, a title long - MAY, DECEMBER....

Re: Determination of number of days in a month (VBS)

Shocker. Pro, I THANK!!!
The variant offered by you is worked!
And what is necessary the code if the title of months is in Russian and system language will be English?

Re: Determination of number of days in a month (VBS)

Well then only through the reference manual, one of variants offered The_Prist

Re: Determination of number of days in a month (VBS)

Only with May there it is necessary to be defined

Re: Determination of number of days in a month (VBS)

Shocker. Pro, checked up by the machine where system language English.

Re: Determination of number of days in a month (VBS)

PUT_2012 wrote:

Shocker. Pro, checked up by the machine where system language English.

system language can also English, and regional settings, quite possibly, Russian

Re: Determination of number of days in a month (VBS)

Prompt still please how to learn an amount of the last days current month?

Re: Determination of number of days in a month (VBS)

Day ()
Whether it is time to take in hands the reference manual on functions VB?

Re: Determination of number of days in a month (VBS)

Shocker. Pro, advise IDE for a spelling and debugging of code VBS

Re: Determination of number of days in a month (VBS)

PUT_2012 wrote:

Shocker. Pro, advise IDE for a spelling and debugging of code VBS

why only I? )) I on VBS do not write, I do not know.