Format Function in VBScript

Results 1 to 3 of 3

Thread: Format Function in VBScript

  1. #1
    Kevin Swail Guest

    Default Format Function in VBScript

    Hi there,<BR><BR>I would like to display a numeric value with a fixed size using leading zeroes, and exactly 2 decimal places eg "000004.00". I have been unable to find a way of doing this short of doing it myself in VB Script. Is there a function similar to format() in VBS?<BR><BR>Thanks!

  2. #2
    Dave2000 Guest

    Default RE: Format Function in VBScript

    I would use something like this:<BR> myNum = "0000" & formatNumber(myNum,2)<BR><BR>If you had the number 55 it would display it like "000055.00"

  3. #3
    -Rob- Guest

    Default RE: Format Function in VBScript

    Kevin<BR><BR>Have you made allowances for your value to be more than 2 decimal places long? (e.g. 4.6789). The question at this point is: Do I Round or do I Truncate. If you are using a SQL Server 7.0 stored procedure, you have the Round() function with a truncating parameter to handle the number to 2 decimal places. If you have to rely on VBScript, then I will still have to ponder the code for the solution.<BR><BR>Just food for thought.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts