Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Numbers issue


Message #1 by "Hugh McLaughlin" <hugh@k...> on Wed, 18 Apr 2001 21:19:33 -0400
Hello everyone and thanks for your help in advance.  I am creating an ASP

script which creates a plain text file.  The text file is then assigned a

unique number which is in part developed using the current date.  My problem

is that when I use the function number=day(now), it returns me a number that

is one digit long for the days 1-9 and two digits long for the days 10

through the rest of the month.  This creates a problem with the file numbers

that vary in length.  How can I get the number to retain a leading zero if

the date is only one digit.  Also, can someone tell me how to retain

trailing zeros as well?



Thanks again.





___________________________________________________



Hugh McLaughlin

President

KMC Mortgage Services, Inc.

KMC Financial Network, Inc.

870 111th Avenue North

Suite 1

Naples, FL  34108

(xxx)-xxx-xxxx

http://www.kmcnetwork.com









Message #2 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 19 Apr 2001 10:49:00 +0100
why not just



strnumber = CStr(number)

if len(strnumber) = n then strnumber = "0" & strnumber 



-----Original Message-----

From: Hugh McLaughlin [mailto:hugh@k...]

Sent: Thursday, April 19, 2001 2:20 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Numbers issue





Hello everyone and thanks for your help in advance.  I am creating an ASP

script which creates a plain text file.  The text file is then assigned a

unique number which is in part developed using the current date.  My problem

is that when I use the function number=day(now), it returns me a number that

is one digit long for the days 1-9 and two digits long for the days 10

through the rest of the month.  This creates a problem with the file numbers

that vary in length.  How can I get the number to retain a leading zero if

the date is only one digit.  Also, can someone tell me how to retain

trailing zeros as well?



Thanks again.





___________________________________________________



Hugh McLaughlin

President

KMC Mortgage Services, Inc.

KMC Financial Network, Inc.

870 111th Avenue North

Suite 1

Naples, FL  34108

(xxx)-xxx-xxxx

http://www.kmcnetwork.com



________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com

Message #3 by "Walter Burrough" <lists@c...> on Thu, 19 Apr 2001 11:41:21 +0100
Hi, 

I do it like this (put the zeros back):



	strTimestamp = year(date()) & _

		padzero(month(date()),2) & _

		padzero(day(date()),2) & _

		padzero(hour(time()),2) & _

		padzero(minute(time()),2) & _

		padzero(second(time()),2)



	function padZero(privIn, privLen)

		dim i, strOut

		strOut = privIn

		if len(padZero) < privLen then

			for i = 1 to privLen-(len(privIn))

				strOut = "0" & strOut

			next

		end if

		padZero = strOut

	end function



Which trailing 0's do you mean?



Walter



> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: 19 April 2001 02:20

> To: ASP Web HowTo

> Subject: [asp_web_howto] Numbers issue

> 

> 

> Hello everyone and thanks for your help in advance.  I am 

> creating an ASP

> script which creates a plain text file.  The text file is 

> then assigned a

> unique number which is in part developed using the current 

> date.  My problem

> is that when I use the function number=day(now), it returns 

> me a number that

> is one digit long for the days 1-9 and two digits long for 

> the days 10

> through the rest of the month.  This creates a problem with 

> the file numbers

> that vary in length.  How can I get the number to retain a 

> leading zero if

> the date is only one digit.  Also, can someone tell me how to retain

> trailing zeros as well?

> 

> Thanks again.

> 

> 

> ___________________________________________________

> 

> Hugh McLaughlin

> President

> KMC Mortgage Services, Inc.

> KMC Financial Network, Inc.

> 870 111th Avenue North

> Suite 1

> Naples, FL  34108

> (xxx)-xxx-xxxx

> http://www.kmcnetwork.com

> 

> 

> 



Message #4 by Hugh McLaughlin <Hugh@k...> on Thu, 19 Apr 2001 12:36:45 -0400
Thanks.  I will give it a try.



-----Original Message-----

From: Walter Burrough [mailto:lists@c...]

Sent: Thursday, April 19, 2001 6:41 AM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Numbers issue





Hi, 

I do it like this (put the zeros back):



	strTimestamp = year(date()) & _

		padzero(month(date()),2) & _

		padzero(day(date()),2) & _

		padzero(hour(time()),2) & _

		padzero(minute(time()),2) & _

		padzero(second(time()),2)



	function padZero(privIn, privLen)

		dim i, strOut

		strOut = privIn

		if len(padZero) < privLen then

			for i = 1 to privLen-(len(privIn))

				strOut = "0" & strOut

			next

		end if

		padZero = strOut

	end function



Which trailing 0's do you mean?



Walter



> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: 19 April 2001 02:20

> To: ASP Web HowTo

> Subject: [asp_web_howto] Numbers issue

> 

> 

> Hello everyone and thanks for your help in advance.  I am 

> creating an ASP

> script which creates a plain text file.  The text file is 

> then assigned a

> unique number which is in part developed using the current 

> date.  My problem

> is that when I use the function number=day(now), it returns 

> me a number that

> is one digit long for the days 1-9 and two digits long for 

> the days 10

> through the rest of the month.  This creates a problem with 

> the file numbers

> that vary in length.  How can I get the number to retain a 

> leading zero if

> the date is only one digit.  Also, can someone tell me how to retain

> trailing zeros as well?

> 

> Thanks again.

> 

> 

> ___________________________________________________

> 

> Hugh McLaughlin

> President

> KMC Mortgage Services, Inc.

> KMC Financial Network, Inc.

> 870 111th Avenue North

> Suite 1

> Naples, FL  34108

> (xxx)-xxx-xxxx

> http://www.kmcnetwork.com

> 

Message #5 by Hugh McLaughlin <Hugh@k...> on Thu, 19 Apr 2001 12:37:22 -0400
Thanks.  I will give it a try.



-----Original Message-----

From: Alex Shiell, ITS, EC, SE [mailto:alex.shiell@s...]

Sent: Thursday, April 19, 2001 5:49 AM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Numbers issue





why not just



strnumber = CStr(number)

if len(strnumber) = n then strnumber = "0" & strnumber 



-----Original Message-----

From: Hugh McLaughlin [mailto:hugh@k...]

Sent: Thursday, April 19, 2001 2:20 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Numbers issue





Hello everyone and thanks for your help in advance.  I am creating an ASP

script which creates a plain text file.  The text file is then assigned a

unique number which is in part developed using the current date.  My problem

is that when I use the function number=day(now), it returns me a number that

is one digit long for the days 1-9 and two digits long for the days 10

through the rest of the month.  This creates a problem with the file numbers

that vary in length.  How can I get the number to retain a leading zero if

the date is only one digit.  Also, can someone tell me how to retain

trailing zeros as well?



Thanks again.





___________________________________________________



Hugh McLaughlin

President

KMC Mortgage Services, Inc.

KMC Financial Network, Inc.

870 111th Avenue North

Suite 1

Naples, FL  34108

(xxx)-xxx-xxxx

http://www.kmcnetwork.com


  Return to Index