Visual Studio .NET - Getting first day of the month

Asked By sarah lee
05-Feb-07 09:34 AM
Hi All,

I want to set two textboxes, where I want to set the first day of current month in one textbox, and todays date in the second text box.

How can I get the first day of the current month?

Thanks In advance
  Sushila Patel replied to sarah lee
05-Feb-07 09:43 AM

You can try

Public Shared Function GetFirstDateOfMonth(ByVal date As DateTime) As DateTime
 Return (New DateTime(date.Year, date.Month, 1))
End Function

first day of the month  first day of the month

05-Feb-07 11:35 AM
you can choose between DateTime.Now.Day or DateTime.Now.ToString("dd")

Have you tried this?  Have you tried this?

05-Feb-07 12:06 PM

//First day of month
textBox1.Text = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1)).ToString();

//Current day
textBox2.Text = DateTime.Now.ToString();

 

thanks everyone, i got it  thanks everyone, i got it
05-Feb-07 01:44 PM
end of post
Create New Account
help
Wise for Visual Studio.NET Wise for Visual Studio.NET By Peter A. Bromberg, Ph.D. To "Print This Page" Link Peter Bromberg Wise for Visual Studio .NET is a total and complete installation development system for creating and editing Windows® Installer
Visual Studio.NET: Help Yourself! Visual Studio.NET: Help Yourself! By Peter A. Bromberg, Ph.D. Peter Bromberg I'm constantly annoyed by the number of developers using Visual Studio.NET who don't seem to see the need to create decent documentation for their
Migrating to Visual Studio.NET 2003: A Developer Perspective Migrating to Visual Studio.Net 2003: A Developer - oriented analysis By Peter A. Bromberg, Ph.D. Printer - Friendly Version Peter Bromberg A new Platform On April 24, 2003 Microsoft Windows Server 2003 and Visual Studio .NET 2003 are officially released. Many developers and beta testers (myself included) have been feverishly
Need Visual Studio .NET 2005 tutorials sites Hi, Can some one send some sites to learn Visual Studio .NET 2005.Need some tutorials. . Thanx in advance Visual Studio 2005 Hands-On Tutorial http: / / www.15seconds.com / issue / 060427.htm Introduction to Visual Studio
Visual Studio .NET 2008 - Speed Up XAML Load Times Do your XAML files load up in Visual Studio .NET 2008 as slow as mine? Here is a workaround that might help. Visual Studio .NET 2008 is an extreme disappointment for me. Its performance is attrocious and the XAML