Solved

format date

Posted on 2003-11-04
4
1,102 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
[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
4 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 9680301
MsgBox Format(<yourDate>, "mmyy")
0
 

Author Comment

by:Able22
ID: 9680414
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
ID: 9680703
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
ID: 9680780
you mean lexpire has to be defined as a string, not a date..  That worked..  Thanks...
0

Featured Post

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!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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