Retrieving Short Date from DateTimePicker

03-11-2003, 07:05 PM
Hi, how do one retrieve the short date from DateTimePicker? I tried DTPicker1.Value and it returns the Long Date and Time. All I want in the format is 03/12/2003 or 12/03/2003

But I can't seem to get this date format that I want. :(

Thanks in advance!

03-11-2003, 09:34 PM
Look at the FormatDateTime() function.

03-12-2003, 12:14 AM
I did set the format to dtpShortDate but when I type DTPicker1.Value
I capture the short date and time. The only problem is I don't want to include the time. Is there anyway to retrieve the date that's all? :(

03-12-2003, 01:36 AM
The datepicker control returns a Date value. A date value consists of two parts, the day & time part.
The format you specify for the dtPicker is for display only, not for the return value.
To format the returned value to a date string use the Format() function.

MsgBox Format(DTPicker1.Value, "dd/mm/yyyy")

03-12-2003, 02:42 AM
Thanks a million Flyguy, now my program is working smoothly... :D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum