473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 15866
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: johkar | last post by:
I need to document.write out a select list populated with the dates for the first and third Wednesday of each month. How do I get to the actual days? <select name="mySelect"> <option value="Oct...
6
by: Ante Perkovic | last post by:
Hi, How to declare datetime object and set it to my birthday, first or last day of this month or any other date. I can't find any examples in VS.NET help! BTW, what is the difference...
2
by: bb | last post by:
any way to prevent displaying the previous and next months in the calendar control? i have tried just blanking the text out in the dayrender IsOtherMonth and also dynamically changing the...
3
by: Sebastian | last post by:
Hello all I have a report where I have two nested groups. I know there are only three standard options for running sum: None, Over Group and Over All. I have a MyTextBox in detail section where...
0
by: larry | last post by:
I am in the process of rewriting one of my first PHP scripts, an event calendar, and wanted to share the code that is the core of the new calendar. My current/previous calendar processed data...
3
by: remya1000 | last post by:
i'm using ASP with MSAccess as database. i have two buttons and two textbox in my page. when i press my first button (First month) i need to display the current month in one textbox and last one...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
HI I have a stored procedure that returns data with a date field in the form of a DateTime type. I need to place data in variables based on days of the week starting with the first thursday of the...
4
by: Chris Gilpin | last post by:
Hey everybody. I have two tables. The first table lists all of the client ids of the clients I am interested in analyzing. The second table lists various data from their different visits to the...
2
by: ncsthbell | last post by:
I am having problems getting the end date to calculate correctly. I start with Quarter '03/02', (YY/QTR), for this it means it is for the 2nd qtr of 2003. My goal is to get the begin & end dates...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.