Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1113
  • Last Modified:

format date

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
Able22
Asked:
Able22
  • 2
1 Solution
 
bobbit31Commented:
MsgBox Format(<yourDate>, "mmyy")
0
 
Able22Author Commented:
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
 
Dang123Commented:
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
 
Able22Author Commented:
you mean lexpire has to be defined as a string, not a date..  That worked..  Thanks...
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now