- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- //Output Data CurrentDate: 01/10/2014 NextMonthDate: 01/11/2014
- private void Form1_Load(object sender, EventArgs e)
- {
- DateTime Date3 = DateTime.Now;
- var Date1 = DateTime.Now;
- var Date2 = DateTime.Now;
- //Current Month Date 1st
- label1.Text = new DateTime(Date1.Year, Date1.Month, 1).ToShortDateString();
- //Next Month Date 1st
- Date3 = new DateTime(Date3.Year, Date3.Month, 1);
- label2.Text = Date3.AddMonths(1).ToShortDateString();
- }
In this code you will learn how to add month in current date.
