Tuesday, 29 November 2011

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:


Printer Friendly Page


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




This script displays the current hour like this: 7


Printer Friendly Page


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




This script displays the current minute like this: 49


Printer Friendly Page


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




This script displays the current second like this: 58

http://www.aspwebpro.com/aspscripts/dates/selectpartoftime.asp

No comments:

Post a Comment