Pawan Lakhara
Pawan Lakhara

Reputation: 1150

show current date in vb.net

i am using vb.net. and I want how to display next six days date from current date.

 lblDate.Text = System.DateTime.Now.ToString("dd MMMM yyyy")

This code display the current date.

Upvotes: 2

Views: 16194

Answers (4)

NeverHopeless
NeverHopeless

Reputation: 11233

You can use AddDays method to advance days of current date and String.Format to format it. Something like this:

 lblDate.Text = String.Format("{0:dd MMMM yyyy}", Now.AddDays(6)) 

You can also use some other methods of DateTime like AddHours, AddMinutes etc, but here best fit is to use AddDays

Upvotes: 4

Patrick Guimalan
Patrick Guimalan

Reputation: 1010

dim 6DaysFromNow = Now.AddDays(6).ToString("dd MMMM yyyy")

Upvotes: 0

Vikram Jain
Vikram Jain

Reputation: 5588

lblDate.Text = System.DateTime.Now.AddDays(6).ToString("dd MMMM yyyy")

Upvotes: 1

Origin
Origin

Reputation: 2023

dim sixDaysfromNow as DateTime = Now.AddDays(6)

Reference: http://msdn.microsoft.com/en-us/library/system.datetime.adddays.aspx

Upvotes: 3

Related Questions