Select Part of Time ASP Script - ASP Web Pro
  Active Server Pages Programming by ASP Web Pro

ASP Scripts

SELECT PART OF TIME

It is often useful to be able to select and display only a specific portion of the time. Here are a few examples that you can use with ASP / VBScript:

<HTML>
<HEAD><TITLE>Printer Friendly Page</TITLE></HEAD>
<BODY>

<% Response.Write DatePart("h", Time()) %>

</BODY>
</HTML>

This script displays the current hour like this: 22

<HTML>
<HEAD><TITLE>Printer Friendly Page</TITLE></HEAD>
<BODY>

<% Response.Write DatePart("n", Time()) %>

</BODY>
</HTML>

This script displays the current minute like this: 31

<HTML>
<HEAD><TITLE>Printer Friendly Page</TITLE></HEAD>
<BODY>

<% Response.Write DatePart("s", Time()) %>

</BODY>
</HTML>

This script displays the current second like this: 28

< Back to ASP Scripts


 

 

Main Menu
Home
ASP Scripts
ASP Tutorials
JavaScripts
Awards
Contact Us

Email This Page

Other Resources
ASP Web Hosting
Search Engine Submission
Programming Help

 

 

 

Other ASP Web Sites

Site Map

 

Last Updated:
06 July 2008