वीबीस्क्रिप्ट डेटपार्ट फंक्शन
❮ पूर्ण वीबीस्क्रिप्ट संदर्भडेटपार्ट फ़ंक्शन किसी दिए गए दिनांक का निर्दिष्ट भाग देता है।
वाक्य - विन्यास
DatePart(interval,date[,firstdayofweek[,firstweekofyear]])
Parameter | Description |
---|---|
interval | Required. The interval of time to return. Can take the following values:
|
date | Required. Date expression to evaluate |
firstdayofweek | Optional. Specifies the day of the week. Can take the following values:
|
firstweekofyear | Optional. Specifies the first week of the year. Can take the following values:
|
उदाहरण
उदाहरण 1
एक तारीख से महीना प्राप्त करें:
<%
d=CDate("2010-02-16")
response.write(DatePart("m",d))
%>
उपरोक्त कोड का आउटपुट होगा:
2
उदाहरण 2
वह महीना प्राप्त करें जिसमें हम हैं:
<%
response.write(DatePart("m",Now()))
%>
उपरोक्त कोड का आउटपुट होगा:
1
उदाहरण 3
घंटा प्राप्त करें:
<%
response.write(DatePart("h",Now())
%>
उपरोक्त कोड का आउटपुट होगा:
13
❮ पूर्ण वीबीस्क्रिप्ट संदर्भ