Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime Picker and date format

Status
Not open for further replies.

solo7

Technical User
Mar 14, 2001
243
0
0
NO
I'm using a DTPicker control in a form. The date is set to display a Custom format set to dd MMM yyyy - and this works fine every time I select a date the correct date is shown in the box. However when I reference the DTPicker.value I always get the American date format ie MM dd yyyy - so when I click on 9th Feb 2005 it says that in my DTPicker window on my form, but in my code it comes out at 2nd Sep 2005.
I've tried forcing the format with:
Code:
DteDateReceived = Format(DTPicker1.Value, "dd MMM yyyy")
I've also checked all my regional settings are set to UK, which they are.

Has anyone else come across this ?

solo7 [thumbsup2]
 
Your code is trying to format a date data type instead of a string. Try doing this:

[tt]
Dim DteDateReceived As Date

DteDateReceived = DTPicker1.Value
MsgBox "" & Format(DteDateReceived, "dd mmm yyyy")[/tt]

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top