[thelist] ASP: getting double digits
Matt Warden
Matt Warden" <mwarden at odyssey-design.com
Thu, 20 Jan 2000 16:59:08 -0500
This ought to give oyu the idea:
varNow = Now
strMonth = MakeCorrect(CStr(Month(varNow)), 2)
strYear = MakeCorrect(Cstr(Year(varNow)), 4)
Function MakeCorrect(strString, ExpectedLength)
If Len(strString) = ExpectedLength THEN strString = "0" & strString
IF trim(strString) = "" THEN
FOR i = 1 to ExpectedLength
strString = strString & "0"
NEXT
MakeCorrect = strString
END Function
--
Matt Warden
mwarden@odyssey-design.com
----- Original Message -----
From: Tab Alleman <talleman@avweb.com>
To: <thelist@lists.evolt.org>
Sent: Thursday, January 20, 2000 4:48 PM
Subject: [thelist] ASP: getting double digits
> I have an ASP script that needs to create a Date-Time string like
this:
>
> YYYYMMDDhhmmss
>
> I'm using Year() Month() etc, to get the data, and then concatenating
them
> all into one string, but the problem is that whenever the day, month,
hour,
> etc is a single digit, those functions always return single digit
values.
>
> So for instance, if Now() is 01/19/00 15:00:00, how can I turn that
into a
> string like this:
>
> 20000119150000
>
> instead of like this:
>
> 20001191500
>
> ?
>
>
>
>
> _______________________________________________________
> unsubscribe+options: http://lists.evolt.org/mailman/listinfo/thelist
> tip harvester: http://lists.evolt.org/harvest/
> email archive: http://lists.evolt.org/archive/
> http://evolt.org/ Workers of the Web, evolt !
>