xref: /trunk/main/helpcontent2/source/text/sbasic/shared/03030130.xhp (revision 9f45b63a3c6074b17472e33f00344270e2b8c316)
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"><bookmark_value>DatePart function</bookmark_value>
35</bookmark>
36<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>
37<paragraph role="paragraph" id="par_idN10546" xml-lang="en-US" l10n="CHG">The DatePart function returns a specified part of a date.</paragraph>
38</section>
39<paragraph role="heading" id="par_idN10549" xml-lang="en-US" level="2" l10n="NEW">Syntax:</paragraph>
40<paragraph role="paragraph" id="par_idN105E8" xml-lang="en-US" l10n="NEW">DatePart (Add, Date [, Week_start [, Year_start]])</paragraph>
41<paragraph role="heading" id="par_idN105EB" xml-lang="en-US" level="2" l10n="NEW">Return value:</paragraph>
42<paragraph role="paragraph" id="par_idN105EF" xml-lang="en-US" l10n="CHG">A Variant containing a date.</paragraph>
43<paragraph role="heading" id="par_idN105F2" xml-lang="en-US" level="2" l10n="NEW">Parameters:</paragraph>
44<paragraph role="paragraph" id="par_idN105F6" xml-lang="en-US" l10n="NEW">
45<emph>Add</emph> - A string expression from the following table, specifying the date interval.</paragraph>
46<embed href="text/sbasic/shared/03030110.xhp#datetable"/>
47<paragraph role="paragraph" id="par_idN10604" xml-lang="en-US" l10n="NEW">
48<emph>Date</emph> - The date from which the result is calculated.</paragraph>
49<embed href="text/sbasic/shared/03030120.xhp#weekyear"/>
50<paragraph role="heading" id="par_idN10611" xml-lang="en-US" level="2" l10n="NEW">Example:</paragraph>
51<paragraph role="code" id="par_idN10615" xml-lang="en-US" l10n="NEW">Sub example_datepart</paragraph>
52<paragraph role="code" id="par_idN10618" xml-lang="en-US" l10n="NEW">msgbox DatePart("ww", "12/31/2005")</paragraph>
53<paragraph role="code" id="par_idN1061B" xml-lang="en-US" l10n="NEW">End Sub</paragraph>
54</body>
55</helpdocument>
56