Re: Leading 0 when displaying month and date if it is a single digit
- From: "McKirahan" <News@xxxxxxxxxxxxx>
- Date: Fri, 27 Jan 2006 18:29:11 -0600
"modemgeek" <modemgeek@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A349C1D1-0CA5-45D7-B42B-496D2E6AC10B@xxxxxxxxxxxxxxxx
> I've been looking around and couldn't find a simple way to format the
month
> and date with a leading zero if it is a single digit. Here's what I have:
>
> today = Month(Now()) & "-" & Day(Now()) & "-" & Year(Now())
>
> Result: 1-27-2006
>
> What I want is 01-27-2006.
>
> Thanks in advance.
Will this help?
Dim dtmNow
dtmNow = Now()
Dim today
today = Right("0" & Month(dtmNOW),2) _
& "-" & Right("0" & Day(dtmNOW),2) _
& "-" & Year(dtmNOW)
Of course the MM-DD-YYYY format is not
recommended (where YYYY-MM-DD is).
.
- Follow-Ups:
- Prev by Date: Re: Modified logon control script
- Next by Date: Re: Leading 0 when displaying month and date if it is a single dig
- Previous by thread: RE: Multiple folder delete
- Next by thread: Re: Leading 0 when displaying month and date if it is a single dig
- Index(es):
Relevant Pages
|
Loading