Date Code

L

Leon Shaw

Dim CurrentDate As Date = Format(Today, "MM/dd/yy")

Dim FutureDate As Date = CurrentDate.AddYears(1)

What am I doing wrong?

I want the CurrentDate to read 07/09/03 and FurtureDate to read 07/09/04,
but in the browser it reads 7/09/2003 and 7/09/2004 respectfully.

Do anyone see something wrong? Please help!
 
N

Natty Gur

Hi,

When you enter a value into DataTime object the value will be keep in
the default format. If you want to write it down in specific format,
reformat it :

System.DateTime CurrentDate = System.DateTime.Now ;
System.DateTime FutureDate = CurrentDate.AddYears(1);
string ww = FutureDate.ToShortDateString ();

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,082
Messages
2,570,589
Members
47,211
Latest member
Shamestone

Latest Threads

Top