468,463 Members | 2,030 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,463 developers. It's quick & easy.

First Day of the Month

I was wondering how to get the first day of the month as a datetime value. I don't want to set the date to a specified format because I want to display it, the way the user has it set on their machine.

Thanks
Jeff
Nov 20 '05 #1
6 15506
Cor
Hi Jeff,

Mostly the first day of the month is day

"1" & now.month & now.year

Was you looking for that?.

Cor
I was wondering how to get the first day of the month as a datetime value.

I don't want to set the date to a specified format because I want to display
it, the way the user has it set on their machine.

Nov 20 '05 #2
Jeff,

Try using
-------------------------------

Dim dtNow As Date = Date.Now
Dim dtFirstOfMonth As Date = dtNow.AddDays(-dtNow.Day + 1)

-------------------------------

HTH,

Trev.

"Jeff" <an*******@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
I was wondering how to get the first day of the month as a datetime value. I don't want to set the date to a specified format because I want to display
it, the way the user has it set on their machine.
Thanks
Jeff

Nov 20 '05 #3
That was exactly what I was looking for

Thank you

----- Trev Hunter wrote: ----

Jeff

Try usin
------------------------------

Dim dtNow As Date = Date.No
Dim dtFirstOfMonth As Date = dtNow.AddDays(-dtNow.Day + 1

------------------------------

HTH

Trev

"Jeff" <an*******@discussions.microsoft.com> wrote in messag
news:AD**********************************@microsof t.com..
I was wondering how to get the first day of the month as a datetime value

I don't want to set the date to a specified format because I want to displa
it, the way the user has it set on their machine
Thank

Jef


Nov 20 '05 #4
* "=?Utf-8?B?SmVmZg==?=" <an*******@discussions.microsoft.com> scripsit:
I was wondering how to get the first day of the month as a datetime
value. I don't want to set the date to a specified format because I want
to display it, the way the user has it set on their machine.


\\\
Dim d As New DateTime(1999, 12, 1)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
Cor
Hi Herfried,

I make from our 2 answers one.

\\\
Dim d As New DateTime(now.year, now.month, 1)
///


:-)

Cor
Nov 20 '05 #6
Cor,

* "Cor" <no*@non.com> scripsit:
I make from our 2 answers one.

\\\
Dim d As New DateTime(now.year, now.month, 1)
///


:-)


:-)

P.S.: I was not sure if I understood the OP's question when
posting my reply.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by johkar | last post: by
6 posts views Thread by Ante Perkovic | last post: by
reply views Thread by larry | last post: by
6 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.