Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Format Conversion Function 1

Status
Not open for further replies.

Jamesm601

Programmer
Feb 6, 2004
27
US
Hi All!

This seems totally simple and obvious, but I can't seem to find it. Is there a VBA function, or even an Excel worksheet function, that will accept as an argument, Excel's numeric date representation (38058 for today's date 3/12/04) and return a real date? Basically, doing the exact opposite of what =DATEVALUE() does. It would look something like

=DATECONVERT(38058) and return something like "3/12/04"

The reason is that I need to concatenate two cells for use in a chart label. One that has a string "Request Received: " and one that contains that funky date number. Without converting it, I end up with something like "Request received: 38058". I'll write my own function if I have to, but I'm just wondering if that work's been done already.

Thanks.
 
Just an FYI if you ever need to do this in Access, TEXT() is not a defined function. You have to use FORMAT()

Code:
Format([table]![field],"mm/dd/yyyy") will return 03/12/2004
Format([table]![field],"dddd mm/dd/yyyy") will return Friday 03/12/2004
 
Thanks Skip.

I actually ended up solving this particular problem with a custom format, but your solution works perfectly.

1 * to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top