Solved

format date

Posted on 2003-11-04
4
1,097 Views
Last Modified: 2010-05-03
I have a date: 11/04/2006 and I want it to be formatted to MMYY, so it would = 1106, is there a formatting function that will do this?
0
Comment
Question by:Able22
  • 2
4 Comments
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
MsgBox Format(<yourDate>, "mmyy")
0
 

Author Comment

by:Able22
Comment Utility
This is what I have in my code currently:


lexpire = Format(vexpire, "mmyy")   ' where vexpire = "10/31/2006"

lexpire gets set to 10/2/1902 , both vexpire and lexpire as Date field types

0
 
LVL 9

Accepted Solution

by:
Dang123 earned 50 total points
Comment Utility
You must have lexpire defined as a date. Format is returning a variant (string). When you assign to the date variable it converts to a date based on what it has (1006). If you change lexpire to a string you will get the result you expect.

0
 

Author Comment

by:Able22
Comment Utility
you mean lexpire has to be defined as a string, not a date..  That worked..  Thanks...
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

771 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

8 Experts available now in Live!

Get 1:1 Help Now