format a number (eg month) to get leading zeros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to return 2 digits of month
eg for myDate = "2003/09/07 07:09" I want to return month as 09
this code = FormatNumber(Month(myDate), 0, vbTrue
doesn't work for me
Thanks
 
FormatNumber(Month(myDate), 0, vbTrue)
doesn't work for me.

Format(Month(myDate), "00")

the reference to FormatNumber suggests you may be working in ASP or VBS, in
which case you have to cook nearly all your formats yourself:

Right("00" & FormatNumber(Month(myDate), 0, vbTrue), 2)

which reminds everybody what a crappy, half-finished language it really is.
Oh, sorry Matron, coming now....


B Wishes


Tim F
 
Back
Top