Free and shareware components


Download Products


DypsWebCapture : Capture Web page as thumbnail image

Documentation
Example
Download
Buy

New release with embed IE and Firefox rendering engine !



DypsFTP : Manage a FTP site from your script

Documentation
Buy


DypsImg2SWF : Protect and save your image as SWF/Flash format!

Documentation
Example
Download
Buy


DypsXLS for ASP: Générateur de fichier Excel

New features!
Documentation
Exemple d'utilisation
Download
Buy


DypsMetaGrabber : get Meta Tag from any web page!

Documentation
Example
Download
Buy


DypsAntiSpam for ASP

Features
Exemple d'utilisation
Download
Buy

DypsoPRank for ASP

Features
Exemple d'utilisation
Download
Buy

Pop3 Checker for ASP

Features
Exemple d'utilisation
Download
Buy

SVG Pie chart Maker for ASP

Features
Exemple d'utilisation
Download

DypsRTF for ASP

Features
Exemple d'utilisation
Download
Buy

What's New ?


Mise en ligne du premier outil gratuit pour générer des fichiers Excel depuis ASP : DypsXLS !
[Lire la suite]

Et un forum Le site se dote d'un forum pour vous permettre de partager toujours plus.
[Rejoigner nous]

Annuaire de scripts ! Un annuaire de scripts et de liens utiles vers des ressources pour le développement
[Lire la suite]

Création d'un outil gratuit pour retrouver ses mails : Pop3 Checker for free !
[Lire la suite]

Création d'un outil gratuit pour générer des graphiques vectoriels à la volée: Free SVG Pie chart Maker !
[Lire la suite]

Format date time with ASP

Techniques

This category is aimed to help programmers in order to find and share helpfull techniques, source code and more stuff.


Techniques / ASP Tips & Tricks : Format Date and Time


  •  ASP : Format Date and Time function

ASP has a very handy inbuild function called FormatDateTime(). Let's start with the now() function to get the current date and time into a variable

<% dim todaysDate todaysDate=now() %>


Now we can use the FormatDateTime function to format our date variable in a variety of ways. First let's see how todaysDate appears :

	
<% 
	Response.write todaysDate
%>

RESULT: 10/27/2005 6:46:17 AM

Using 0 - the vbGeneralDate format creates a date as short date (if included), and time as long time.

<% 
Response.write FormatDateTime(todaysDate,0)
%>		

RESULT: 10/27/2005 6:46:17 AM

Using 1 - the vbLongDate shows the date as long date

&t;% 
Response.write FormatDateTime(todaysDate,1)
%>

RESULT: Thursday, October 27, 2005

Using 2 - the vbShortDate shows the date as short date

<% 
Response.write FormatDateTime(todaysDate,2)
%>

RESULT: 10/27/2005

Using 3 - the vbLongTime format shows the time as long time .

<% 
Response.write FormatDateTime(todaysDate,3)
%>

RESULT: 6:46:17 AM

Using 4 - the vbShortTime format creates the current time in 24 format (hh:mm)

<%
Response.write FormatDateTime(todaysDate,4)
%>

RESULT: 06:46

International Date and Time You can use the session.lcid property to change the formatting of the date and time.

For example

<%session.lcid=2057%>

will set the date and time to UK format (DD/MM/YYYY instead of MM/DD/YYYY ) Here's a list of international locales. Bear in mind that setting these will also change currency formatting.

Locale ID (LCID) Description
1033 General Unicode
33280 Binary Order
1027 Catalan
197636 Chinese Bopomofo (Taiwan)
2052 Chinese Punctuation
133124 Chinese Stroke Count
1028 Chinese Stroke Count (Taiwan)
1050 Croatian
1029 Czech
1043 Dutch
1061 Estonian
1036 French
66615 Georgian Modern
1031 German
66567 German Phone Book
1038 Hungarian
66574 Hungarian Technical
1039 Icelandic
1040 Italian
1041 Japanese
66577 Japanese Unicode
1042 Korean
66578 Korean Unicode
1062 Latvian
1063 Lithuanian
1071 FYRO Macedonian
1044 Norwegian/Danish
1045 Polish
1046 Portuguese
1048 Romanian
1051 Slovak
1060 Slovenian
1034 Spanish (Traditional)
3082 Spanish (Spain)
1053 Swedish/Finnish
1054 Thai
2057 UK English
1058 Ukrainian
1066 Vietnamese