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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format date obj with leading Zeroe ??? 1

Status
Not open for further replies.

Dylan

MIS
Aug 27, 1998
109
US
I have a date fld that I need help in converting into a string using leading zeroes for month and day as needed.

depdte(date/time) has date value of 9/1/2004

tried this but didnt work

wsdte = Format(DatePart("m", Irs.Fields("depdte"), "00"))

This returns: 9

I need it to return: 09

Thanks for any help on this ...

Tom Moran
Lansing, Michigan
 
Tom Moran,

This give you TEXT -- NOT a DATE!
[tt]
x = format(DatePart, "mm/dd/yyyy")
[/tt]
or just to return month...
[tt]
x = format(DatePart, "mm")
[/tt]


Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
skip,

where should depdte be included in code ???

Tom Moran
Lansing, Michigan
 
sorry
[tt]
txtDateString = format(depdte, "mm/dd/yyyy")
txtMonthString = format(depdte, "mm")
[/tt]


Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
THANKS Skip


works like a charm .... :)

Tom Moran
Lansing, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top