|
Find out part of a date
Using the DatePart function we can return a specified
part of any date .
The parts we can return are as follows
d : Day
h : hour
m : month
n : minute
q : quarter
s : second
w : weekday
ww : week of year
y : day of year
yyyy : year
Code:
<%
'DatePart examples
'we will be using the Now() function for the date in all examples
'we will display the week number
Response.Write DatePart("ww" , Now) & "<br>"
'display the weekday
Response.Write DatePart("w" , Now) & "<br>"
'display the hour
Response.Write DatePart("h" , Now) & "<br>"
'display the day
Response.Write DatePart("d" , Now) & "<br>"
%>
|