| Format Special Data ASP Tutorial - ASP Web Pro |
|
ASP TutorialsFORMAT SPECIAL DATAIf you want to display numbers from a database on your web page, chances are you will have to do some formatting to get your data to display the way you want it to. Here are a few examples. Dates:
There are a lot of ways to display dates. The first line returns the short date in a 28/08/2008 format while the second line returns the long date in a 28 August 2008 format. Times:
There are a lot of ways to display dates. The first line returns the short date in a 02:47 format while the second line returns the long date in a 02:47:23 format. If you want the display to update and continue counting seconds live on the users browser, you need to use JavaScript to do this. Currency:
When displaying currency, these are the system default settings. The first setting Variable is the variable containing the amount. The second setting is the number of decimal places. The third setting specifies not to use leading zeros for numbers less than one. The fourth setting specifies not to use parenthesis around negative numbers. The fifth setting specifies not to use a comma to separate number larger than one thousand. As you can see, the third, fourth, and fifth settings are in the "off" position by default. To turn these settings "on", replace their respective -2 setting with a -1. To specify the number of decimals to use, simply change the second setting from -1 to whatever number you want. Numbers:
When displaying numbers, Cint displays the Integer subtype which takes up 2 bytes in memory and can contain a value between -32,768 and 32,767.
When displaying numbers, Clng displays the Long subtype which takes up 4 bytes in memory and can contain a value between -2,147,483,648 and 2,147,483,647.
When displaying numbers, Cdbl displays the Double subtype which takes up 8 bytes in memory, 4 bytes of which are used for contatining fractional values. It is a very precise subtype used for advanced mathematical expressions including fractional or decimal values. These are just a few of the most common techniques for formatting special data. We will continue to add more formatting techniques to this page as time goes on so be sure to check back here for new additions. Happy Formatting!
|
||||||||
|
Main Menu Other Resources
Last Updated:
|
||||||||
|
© 1997-2008 ASP Web Pro, Inc. | Terms of Use
|