View Full Version : Solved: parsing dates
TrippyTom
08-10-2009, 09:05 AM
Dim mydate As Date
mydate = Date
mymonth = Left(mydate, 2)
mydate = "8/10/2009"
mymonth = "8/"
Is there a way to force the month to have 2 numeral spaces (force a leading zero)?
Tommy
08-10-2009, 09:47 AM
Hi Tom,
If you are just looking for the Month Try:
Dim mydate As Date
mydate = Date
mymonth = Month(mydate)
or depending on your needs
mymonth = Month(Date)
I would do this:
strMonth = IIf(Month(Date) < 10, "0" & CStr(Month(Date)), CStr(Month(Date)))
HTH
EDIT: Fixed an error Tommy
John Wilson
08-10-2009, 01:09 PM
mymonth = Format(mydate, "mm")
TrippyTom
08-10-2009, 11:45 PM
thanks guys. didn't have time to try it out today but i'll mark it solved.
TrippyTom
08-11-2009, 06:21 AM
Heh, it seems I always try to do things the hard way. Thanks again.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.