Solved

DTPicker date stored as variable

Posted on 2000-05-04
6
337 Views
Last Modified: 2010-05-02
I want to store the formatted date as a string variable to use in other places.  I have tried the following code:

Dim Letter_Date As String
Letter_Date = Form1.DTPicker1.Value

But the variable Letter_Date comes back as 05/05/00, but I want it to be May 5, 2000.

The control is displaying the date in the correct format, so my question is how do you store the displayed (formatted) date as a variable?

Thank you,


0
Comment
Question by:mhewes
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Expert Comment

by:GivenRandy
Comment Utility
Doubleclick on the DateTimePicker control.

Set the type to:

3 - dtpCustom

In the CustomFormat field, set to:

MMM d, yyyy

Or, if you want two digit days:

MMM dd, yyyy
0
 
LVL 9

Expert Comment

by:GivenRandy
Comment Utility
I mean, right-click then Properties.
0
 

Author Comment

by:mhewes
Comment Utility
This has already been done.  I stated in the question that DTPicker is displaying the correct format.  What I want to do is to store the formatted date to a string variable so that I can insert the date into other text.

Thanks,

0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 5

Accepted Solution

by:
AnswerTheMan earned 50 total points
Comment Utility
Dim X As Date
    X = DTPicker1.Value
    MsgBox FormatDateTime(X, vbLongDate)
0
 
LVL 5

Expert Comment

by:AnswerTheMan
Comment Utility
Dim X As String
X = FormatDateTime(DTPicker1.Value, vbLongDate)
MsgBox X
0
 

Author Comment

by:mhewes
Comment Utility
Thanks AnswerMan, that was too easy for you!

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now