Monday, December 17, 2007

How to get the Time and Date

How to get the Time and Date

S T E P - 1

- To get the current date:

<% =Date() %>

S T E P - 2

- Get the current date and time:

<% =Now() %>

S T E P - 3

- If you only want to show the time:

<% =Time() %>

S T E P - 4

- You can show the date or time in a different format:

<%

FormatDateTime(Now(), vbGeneralDate)

'the output => 12/30/2000 4:33:40 AM

FormatDateTime(Now(), vbLongDate)

'the output => Saturday, December 30, 2000

FormatDateTime(Now(), vbShortDate)

'the output => 12/30/2000

FormatDateTime(Now(), vbLongTime)

'the output => 4:33:40 AM

FormatDateTime(Now(), vbShortTime)

'the output => 04:33

%>

No comments: