![]() |
|
|
Date, Time, Hour, Now functionsThese are handy VBScript functions that allow us to easily access date and times. They return a value taken from the computer's system clock. The Date function <%
Dim theDate 'create variable that will store the date theDate=Date 'the Date function returns the date and we assign it to the variable Response.write theDate 'write out the date %> The date is: 13/05/2008 The Time function<%
Dim theTime 'create variable that will store the time theTime=Time'the Time function returns the date and we assign it to the variable Response.write theTime 'write out the time %> The time here in Ireland is: 14:23:32 The Now function <%
Dim varNow 'create variable that will store date and time varNow=Now 'the Now function returns the date & time - assign it to the variable Response.write varNow 'write out the date and time %> The date and time is: 13/05/2008 14:23:32 Notice that all the functions above haven't any parameters passed in unlike the Hour function below. The Hour functionThe Hour function returns a number between 0 and 23 that represents the hour of the day. <%
Dim theHour 'create variable that will store the hour theHour=Hour(Now)'we pass in the Now function as a parameter Response.write theHour 'write out the hour %> The hour here is: 14 Other date and time related tutorials: Here's a code snippet to display the day
and date (eg. Mon 25 December).
Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|