1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23
24<helpdocument version="1.0">
25<meta>
26<topic id="textsbasicshared03030130xhp" indexer="include" status="PUBLISH">
27<title id="tit" xml-lang="en-US">DatePart Function [Runtime]</title>
28<filename>/text/sbasic/shared/03030130.xhp</filename>
29</topic>
30<comment>DatePart</comment>
31</meta>
32<body>
33<section id="datepart">
34<bookmark xml-lang="en-US" branch="index" id="bm_id249946">
35<bookmark_value>DatePart function</bookmark_value>
36</bookmark>
37<paragraph role="heading" id="par_idN10542" xml-lang="en-US" level="1" l10n="NEW"><link href="text/sbasic/shared/03030130.xhp">DatePart Function [Runtime]</link></paragraph>
38<paragraph role="paragraph" id="par_idN10546" xml-lang="en-US" l10n="CHG">The DatePart function returns a specified part of a date.</paragraph>
39</section>
40<paragraph role="heading" id="par_idN10549" xml-lang="en-US" level="2" l10n="NEW">Syntax:</paragraph>
41<paragraph role="paragraph" id="par_idN105E8" xml-lang="en-US" l10n="NEW">DatePart (Add, Date [, Week_start [, Year_start]])</paragraph>
42<paragraph role="heading" id="par_idN105EB" xml-lang="en-US" level="2" l10n="NEW">Return value:</paragraph>
43<paragraph role="paragraph" id="par_idN105EF" xml-lang="en-US" l10n="CHG">A Variant containing a date.</paragraph>
44<paragraph role="heading" id="par_idN105F2" xml-lang="en-US" level="2" l10n="NEW">Parameters:</paragraph>
45<paragraph role="paragraph" id="par_idN105F6" xml-lang="en-US" l10n="NEW">
46<emph>Add</emph> - A string expression from the following table, specifying the date interval.</paragraph>
47<embed href="text/sbasic/shared/03030110.xhp#datetable"/>
48<paragraph role="paragraph" id="par_idN10604" xml-lang="en-US" l10n="NEW">
49<emph>Date</emph> - The date from which the result is calculated.</paragraph>
50<embed href="text/sbasic/shared/03030120.xhp#weekyear"/>
51<paragraph role="heading" id="par_idN10611" xml-lang="en-US" level="2" l10n="NEW">Example:</paragraph>
52<paragraph role="code" id="par_idN10615" xml-lang="en-US" l10n="NEW">Sub example_datepart</paragraph>
53<paragraph role="code" id="par_idN10618" xml-lang="en-US" l10n="NEW">msgbox DatePart("ww", "12/31/2005")</paragraph>
54<paragraph role="code" id="par_idN1061B" xml-lang="en-US" l10n="NEW">End Sub</paragraph>
55</body>
56</helpdocument>
57