Solved

DTPicker date stored as variable

Posted on 2000-05-04
6
439 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2779048
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
ID: 2779050
I mean, right-click then Properties.
0
 

Author Comment

by:mhewes
ID: 2779066
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

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

Expert Comment

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

Author Comment

by:mhewes
ID: 2779113
Thanks AnswerMan, that was too easy for you!

0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, 7 hours left to enroll

626 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