Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2006, 03:26 PM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to groovedrm
Default Date Formatting, need some assistance

Hi. I've got a pretty simple question, but didn't find exactly what I needed when looking around.

I'm trying to format a date looking like this:
09/30/2006 - 09:30:03

to something like this:
09302006093003 -but as a string.

I'm sure I could do this with string functions, but I figured there was some kind of date function that accomplished it--so far, I haven't been able to come up with something to do this.

Can anyone help?
 
Old June 14th, 2006, 04:10 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Try this....

Code:
dim theDate as Date

theDate = "09/30/2006 - 09:30:03"

msgbox Format(theDate, "MMDDYYYYHHMMSS")
I think that should work,

Mike

Mike
EchoVue.com
 
Old June 16th, 2006, 07:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Mike, I'm not so sure... in your example, theDate is a string. Therefore, for GrooveDrm to get what he/she wants (WELCOME TO P2P!), a series of LEFT, MID, and/or RIGHT function calls will have to be used with the INSTR function as well.

Your code would definitely work if theDate was truly in a date format type, but it's not.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Formatting MargateFan XSLT 3 August 30th, 2006 07:42 AM
Date formatting jroxit Classic ASP Basics 3 February 26th, 2006 10:07 PM
Date Formatting ozPATT Excel VBA 2 October 31st, 2005 12:03 PM
formatting date time Adam H-W Classic ASP Basics 4 September 29th, 2004 03:35 AM
Formatting to a Date trekmp ADO.NET 2 March 16th, 2004 01:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.