![]() |
|
|
Displaying and formatting Dates and TimesJust to clear up an issue, the date and time displayed on this page are provided by my server so may not be the same where you are. Some of the dates are displayed in UK format ie dd/mm/yyyy rather than the American mm/dd/yyyy, though they'll display correctly according to where your server is located. <% strNow=Now()' this variable
will be used later below %>
strNow holds the value 10/05/2008 03:03:02 <%= Date() %> prints out 10/05/2008 <%= Now() %> prints out 10/05/2008 03:03:02 <%= Time() %> prints out 03:03:02 <%= FormatDateTime(strNow, vbGeneralDate)
%> prints out 10/05/2008 <%= FormatDateTime(strNow, vbLongDate)
%> prints out 10 May 2008 <%= FormatDateTime(strNow,vbShortDate)
%> prints out 10/05/2008 <%= FormatDateTime(strNow, vbLongTime)
%> prints out 03:03:02 <%= FormatDateTime(strNow, vbShortTime)
%> prints out 03:03 <%= Year(strNow) %> prints out
2008 <%= Month(strNow) %> prints out
5 <%=Day(strNow) %> prints out
10 <%=Hour(strNow) %> prints out
3 <%=Minute(strNow) %> prints out
3 <%=Second(strNow) %> prints out
2 <%= WeekDay(strNow) %> prints
out 7 <%= WeekDayName(WeekDay(strNow)) %>
prints out Saturday <%= WeekDayName(WeekDay(strNow), 1) %>
prints out Sat Other date and time related tutorials:
Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|