



(4 ratings)
Dates:
|
There are a lot of ways to display dates. The first line returns the short date in a 25/06/2008 format while the second line returns the long date in a 25 June 2008 format.
Times:
|
There are a lot of ways to display dates. The first line returns the short date in a 14:48 format while the second line returns the long date in a 14:48:00 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:
<% Response.Write FormatCurrency ( Variable, -1, -2, -2, -2) %> |
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:
<% Cint (Variable) %> |
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.
<% Clng (Variable) %> |
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.
<% Cdbl (Variable) %> |
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
20 Random Tutorials from the same category :
Server Variables In ASP
Creating Databases
Counter in ASP
NEW WAY TO HANDLE VARIABLES
The Recordset Object
Randomizer for ASP
ASP.NET Tutorial - Making image thumbnails
Reading form variables passed in the URL
Processing Form Information In ASP
Iterating through Collections In ASP
Date and Time Functions In ASP
Text Editors and Software to Write ASP
Passing Query Strings In Asp
Recordset Access Methods
SQL Access Methods In ASP
String Functions
Reading a Database
ASP.NET 2 Special Purpose Folders
Displaying Server Values In ASP
The Connection Object














