Leading zeros for intergers?
Hi to all the WScript & VBS gurus - hoping you can give a relative nube a hand...
I'm tring to format numbers in the range 0-99 with a field width of 2 i.e the single digits 0-9 should contain a leading zero makeing 00-09. In other words like the C comand:
printf("%02d",...)
I've been scouring the WScript 5.6 documentation but so far no joy.
My intended purpose is to be able to create a date string in the form YYYYMMDD in which the MM & DD fields must always be 2 digits (and YYYY 4 digits) from the PC's current date value.
Up until now I've been using the FormatDateTime function, but that is dependant on the ShortDate & Locale settings of the PC which has caused me trouble in the past when it changes. It would make life so much easier if I could create this format independantly of the PC Locale by taking the Day, Month & Year values individually, formatting & concatenating them into what I want.
Looking forward to any suggestions...