[Libreoffice-commits] help.git: source/text

Alain Romedenne (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 24 13:30:36 UTC 2021


 source/text/sbasic/shared/01020100.xhp |   18 ++++++++++++++++++
 source/text/sbasic/shared/03030110.xhp |   32 ++++++++++++++++----------------
 source/text/sbasic/shared/03030120.xhp |   28 ++++++++++++++--------------
 source/text/sbasic/shared/03030130.xhp |   30 +++++++++++++++---------------
 4 files changed, 63 insertions(+), 45 deletions(-)

New commits:
commit 1b6dd9ef516340ceeef990671ea1571b70794d0e
Author:     Alain Romedenne <alain.romedenne at libreoffice.org>
AuthorDate: Wed Mar 17 18:08:22 2021 +0100
Commit:     Rafael Lima <rafael.palma.lima at gmail.com>
CommitDate: Wed Mar 24 14:30:15 2021 +0100

    Basic DateXXX methods
    
    - Fix to Basic DateXxx examples
    - Locale independant date literals documentation
    - keywords arguments examples
    
    Change-Id: I906b035bb687e6164c6b296f50449986414fa756
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/112616
    Tested-by: Jenkins
    Reviewed-by: Rafael Lima <rafael.palma.lima at gmail.com>

diff --git a/source/text/sbasic/shared/01020100.xhp b/source/text/sbasic/shared/01020100.xhp
index 7a769d70e..cc9fcbdd4 100644
--- a/source/text/sbasic/shared/01020100.xhp
+++ b/source/text/sbasic/shared/01020100.xhp
@@ -34,6 +34,7 @@
   <bookmark_value>types of variables</bookmark_value>
   <bookmark_value>declaring variables</bookmark_value>
   <bookmark_value>values;of variables</bookmark_value>
+  <bookmark_value>literals;date</bookmark_value>
   <bookmark_value>literals;integer</bookmark_value>
   <bookmark_value>literals;hexadecimal</bookmark_value>
   <bookmark_value>literals;integer</bookmark_value>
@@ -174,6 +175,23 @@
 <paragraph id="par_idm1341092144" role="bascode" localize="false" xml-lang="en-US">Dim Variable As Date</paragraph>
 </bascode>
 
+<h3 id="hd_DateLiterals">Literals for Dates</h3>
+<section id="DateLiterals">
+<paragraph role="paragraph" id="par_id151616083357363">Date literals allow to specify unambiguous date variables that are independant from the current language. Literals are enclosed between hash signs <literal>#</literal>. Possible formats are:</paragraph>
+<list type="unordered">
+    <listitem>
+        <paragraph id="par_id41616083766108" role="listitem">#<literal>yyyy-mm-dd</literal>#</paragraph>
+    </listitem>
+    <listitem>
+        <paragraph id="par_id271616083874773" role="listitem"><literal>#mm/dd/yyyy#</literal></paragraph>
+    </listitem>
+</list>
+</section>
+<bascode>
+  <paragraph role="bascode" id="bas_id201616314705492">zeroDay = #12/30/1899#</paragraph>
+  <paragraph role="bascode" id="bas_id616163714705267">dob = #2010-09-28#</paragraph>
+</bascode>
+
 <h2 id="hd_id3148732">Initial Variable Values</h2>
 <paragraph id="par_id3154549" role="paragraph" xml-lang="en-US">As soon as the variable has been declared, it is automatically set to the "Null" value. Note the following conventions:</paragraph>
 <paragraph id="par_id3143222" role="paragraph" xml-lang="en-US"> <emph>Numeric</emph> variables are automatically assigned the value "0" as soon as they are declared.</paragraph>
diff --git a/source/text/sbasic/shared/03030110.xhp b/source/text/sbasic/shared/03030110.xhp
index 9fb32487b..edd12653f 100644
--- a/source/text/sbasic/shared/03030110.xhp
+++ b/source/text/sbasic/shared/03030110.xhp
@@ -34,27 +34,27 @@
 </bookmark>
 
 
-<paragraph id="par_idN10548" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03030110.xhp">DateAdd Function</link></paragraph>
-<paragraph id="par_idN10558" role="paragraph" xml-lang="en-US">Adds a date interval to a given date a number of times and returns the resulting date.</paragraph>
+<h1 id="par_idN10548" xml-lang="en-US"><link href="text/sbasic/shared/03030110.xhp">DateAdd Function</link></h1>
+<paragraph id="par_idN10558" role="paragraph" xml-lang="en-US">Adds a date or time interval to a given date a number of times and returns the resulting date.</paragraph>
 </section>
 
-<paragraph id="par_idN1055B" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
 <bascode>
-<paragraph id="par_idN1055F" role="bascode" xml-lang="en-US">DateAdd (Add, Count, Date)</paragraph>
+<paragraph id="par_idN1055F" role="bascode" xml-lang="en-US">DateAdd (interval As String, number As Long, date As Date) As Date</paragraph>
 </bascode>
 
-<paragraph id="par_idN1061E" role="heading" level="2" xml-lang="en-US">Return value:</paragraph>
+<paragraph id="par_idN1061E" role="heading" level="3" xml-lang="en-US">Return value:</paragraph>
 <paragraph id="par_idN10622" role="paragraph" xml-lang="en-US">A Variant containing a date.</paragraph>
 
-<paragraph id="par_idN10625" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
-  <paragraph id="par_idN10629" role="paragraph" xml-lang="en-US"><emph>Add</emph> - A string expression from the following table, specifying the date interval.</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+  <paragraph id="par_idN10629" role="paragraph" xml-lang="en-US"><emph>interval</emph> - A string expression from the following table, specifying the date or time interval.</paragraph>
 
 <section id="datetable">
 
 <table id="tbl_id7568285">
   <tablerow>
     <tablecell>
-      <paragraph id="par_idN10636" role="tablehead" xml-lang="en-US">Add (string value)</paragraph>
+      <paragraph id="par_idN10636" role="tablehead" xml-lang="en-US">interval (string value)</paragraph>
     </tablecell>
     <tablecell>
       <paragraph id="par_idN1063C" role="tablehead" xml-lang="en-US">Explanation</paragraph>
@@ -143,15 +143,15 @@
 </table>
 
 </section>
-<paragraph id="par_idN106C1" role="paragraph" xml-lang="en-US"><emph>Count</emph> - A numerical expression specifying how often the Add interval will be added (Count is positive) or subtracted (Count is negative).</paragraph>
-<paragraph id="par_idN106C4" role="paragraph" xml-lang="en-US"><emph>Date</emph> - A given date or the name of a Variant variable containing a date. The Add value will be added Count times to this value.</paragraph>
+<paragraph id="par_idN106C1" role="paragraph" xml-lang="en-US"><emph>number</emph> - A numerical expression specifying how often the <literal>interval</literal> value will be added when positive or subtracted when negative.</paragraph>
+<paragraph id="par_idN106C4" role="paragraph" xml-lang="en-US"><emph>date</emph> - A given date or the name of a Variant variable containing a date. The <literal>interval</literal> value will be added <literal>number</literal> times to this date.</paragraph>
+<embed href="text/sbasic/shared/01020100.xhp#DateLiterals"/>
 
-<paragraph id="par_idN106C7" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
-<bascode>
-<paragraph id="par_idm1340825424" role="bascode" localize="false" xml-lang="en-US">Sub example_dateadd</paragraph>
-<paragraph id="par_idm1340824192" role="bascode" localize="false" xml-lang="en-US">    MsgBox DateAdd("m", 1, "1/31/2004") &" - "& DateAdd("m", 1, "1/31/2005")</paragraph>
-<paragraph id="par_idm1340822896" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functexample"/><bascode>
+<paragraph id="par_idm1340825424" role="bascode" localize="false">Sub example_dateadd</paragraph>
+<paragraph id="par_idm1340824192" role="bascode" localize="false">    MsgBox DateAdd("m", 1, #1/31/2004#) &" - "& DateAdd(date:=#2005-01-31#, interval:="m", number:=1)</paragraph>
+<paragraph id="par_idm1340822896" role="bascode" localize="false">End Sub</paragraph>
 </bascode>
-</body>
 
+</body>
 </helpdocument>
\ No newline at end of file
diff --git a/source/text/sbasic/shared/03030120.xhp b/source/text/sbasic/shared/03030120.xhp
index fdcbbcc61..e1e8a2c89 100644
--- a/source/text/sbasic/shared/03030120.xhp
+++ b/source/text/sbasic/shared/03030120.xhp
@@ -33,31 +33,31 @@
   <bookmark_value>DateDiff function</bookmark_value>
 </bookmark>
 
-
-<paragraph id="par_idN10542" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03030120.xhp">DateDiff Function</link></paragraph>
-<paragraph id="par_idN10546" role="paragraph" xml-lang="en-US">Returns the number of date intervals between two given date values.</paragraph>
+<h1 id="par_idN10542" xml-lang="en-US"><link href="text/sbasic/shared/03030120.xhp">DateDiff Function</link></h1>
+<paragraph id="par_idN10546" role="paragraph" xml-lang="en-US">Returns the number of date or time intervals between two given date values.</paragraph>
 </section>
 
-<paragraph id="par_idN10549" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
 <bascode>
-<paragraph id="par_idN10648" role="bascode" xml-lang="en-US">DateDiff (Add, Date1, Date2 [, Week_start [, Year_start]])</paragraph>
+<paragraph id="par_idN10648" role="bascode" xml-lang="en-US">DateDiff (interval As String, date1 As Date, date2 As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Double</paragraph>
 </bascode>
 
 <paragraph id="par_idN1064B" role="heading" level="2" xml-lang="en-US">Return value:</paragraph>
 <paragraph id="par_idN1064F" role="paragraph" xml-lang="en-US">A number.</paragraph>
 
-<paragraph id="par_idN10652" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
-<paragraph id="par_idN10656" role="paragraph" xml-lang="en-US"> <emph>Add</emph> - A string expression from the following table, specifying the date interval.</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+<paragraph id="par_idN10656" role="paragraph" xml-lang="en-US"> <emph>interval</emph> - A string expression from the following table, specifying the date or time interval.</paragraph>
 <embed href="text/sbasic/shared/03030110.xhp#datetable"/>
-<paragraph id="par_idN10664" role="paragraph" xml-lang="en-US"> <emph>Date1, Date2</emph> - The two date values to be compared.</paragraph>
+<paragraph id="par_idN10664" role="paragraph" xml-lang="en-US"> <emph>date1, date2</emph> - The two date values to be compared.</paragraph>
+<embed href="text/sbasic/shared/01020100.xhp#DateLiterals"/>
 
 <section id="weekyear">
-<paragraph id="par_idN1066A" role="paragraph" xml-lang="en-US"> <emph>Week_start</emph> - An optional parameter that specifies the starting day of a week. </paragraph>
+<paragraph id="par_idN1066A" role="paragraph" xml-lang="en-US"> <emph>firstDayOfWeek</emph> - An optional parameter that specifies the starting day of a week. </paragraph>
 
 <table id="tbl_id8356883">
   <tablerow>
     <tablecell>
-      <paragraph id="par_idN1067A" role="tablehead" xml-lang="en-US">Week_start value</paragraph>
+      <paragraph id="par_idN1067A" role="tablehead" xml-lang="en-US">firstDayOfWeek value</paragraph>
     </tablecell>
     <tablecell>
       <paragraph id="par_idN10680" role="tablehead" xml-lang="en-US">Explanation</paragraph>
@@ -129,12 +129,12 @@
   </tablerow>
 </table>
 
-<paragraph id="par_idN106EB" role="paragraph" xml-lang="en-US"> <emph>Year_start</emph> - An optional parameter that specifies the starting week of a year. </paragraph>
+<paragraph id="par_idN106EB" role="paragraph" xml-lang="en-US"> <emph>firstWeekOfYear</emph> - An optional parameter that specifies the starting week of a year. </paragraph>
 
 <table id="tbl_id1173436">
   <tablerow>
     <tablecell>
-      <paragraph id="par_idN106FB" role="tablehead" xml-lang="en-US">Year_start value</paragraph>
+      <paragraph id="par_idN106FB" role="tablehead" xml-lang="en-US">firstWeekOfYear value</paragraph>
     </tablecell>
     <tablecell>
       <paragraph id="par_idN10701" role="tablehead" xml-lang="en-US">Explanation</paragraph>
@@ -176,10 +176,10 @@
 
 </section>
 
-<paragraph id="par_idN10738" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functexample"/>
 <bascode>
 <paragraph id="par_idm1341501344" role="bascode" localize="false" xml-lang="en-US">Sub example_datediff</paragraph>
-<paragraph id="par_idm1341500112" role="bascode" localize="false" xml-lang="en-US">    MsgBox DateDiff("d", "1/1/2005", "12/31/2005")</paragraph>
+<paragraph id="par_idm1341500112" role="bascode" localize="false" xml-lang="en-US">    MsgBox DateDiff("d", #1/1/2005#, #2005-12-31#)</paragraph>
 <paragraph id="par_idm1341498848" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
 </bascode>
 </body>
diff --git a/source/text/sbasic/shared/03030130.xhp b/source/text/sbasic/shared/03030130.xhp
index 69beffd4b..5934bb13b 100644
--- a/source/text/sbasic/shared/03030130.xhp
+++ b/source/text/sbasic/shared/03030130.xhp
@@ -33,31 +33,31 @@
   <bookmark_value>DatePart function</bookmark_value>
 </bookmark>
 
-
-<paragraph id="par_idN10542" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03030130.xhp">DatePart Function</link></paragraph>
+<h1 id="par_idN10542" xml-lang="en-US"><link href="text/sbasic/shared/03030130.xhp">DatePart Function</link></h1>
 <paragraph id="par_idN10546" role="paragraph" xml-lang="en-US">The DatePart function returns a specified part of a date.</paragraph>
 </section>
 
-<paragraph id="par_idN10549" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
 <bascode>
-<paragraph id="par_idN105E8" role="bascode" xml-lang="en-US">DatePart (Add, Date [, Week_start [, Year_start]])</paragraph>
+<paragraph id="par_idN105E8" role="bascode" xml-lang="en-US">DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long</paragraph>
 </bascode>
 
-<paragraph id="par_idN105EB" role="heading" level="2" xml-lang="en-US">Return value:</paragraph>
-<paragraph id="par_idN105EF" role="paragraph" xml-lang="en-US">A Variant containing a date.</paragraph>
+<paragraph id="par_idN105EB" role="heading" level="3" xml-lang="en-US">Return value:</paragraph>
+<paragraph id="par_idN105EF" role="paragraph" xml-lang="en-US">The extracted part for the given date.</paragraph>
 
-<paragraph id="par_idN105F2" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
-<paragraph id="par_idN105F6" role="paragraph" xml-lang="en-US"> <emph>Add</emph> - A string expression from the following table, specifying the date interval.</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+<paragraph id="par_idN105F6" role="paragraph" xml-lang="en-US"> <emph>interval</emph> - A string expression from the following table, specifying the date interval.</paragraph>
 <embed href="text/sbasic/shared/03030110.xhp#datetable"/>
-<paragraph id="par_idN10604" role="paragraph" xml-lang="en-US"> <emph>Date</emph> - The date from which the result is calculated.</paragraph>
+<paragraph id="par_idN10604" role="paragraph" xml-lang="en-US"> <emph>date</emph> - The date from which the result is calculated.</paragraph>
+<embed href="text/sbasic/shared/01020100.xhp#DateLiterals"/>
 <embed href="text/sbasic/shared/03030120.xhp#weekyear"/>
 
-<paragraph id="par_idN10611" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
-<bascode>
-<paragraph id="par_idm1341577504" role="bascode" localize="false" xml-lang="en-US">Sub example_datepart</paragraph>
-<paragraph id="par_idm1341576272" role="bascode" localize="false" xml-lang="en-US">    MsgBox DatePart("ww", "12/31/2005")</paragraph>
-<paragraph id="par_idm1341575024" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
+<embed href="text/sbasic/shared/00000003.xhp#functexample"/><bascode>
+<paragraph id="par_idm1341577504" role="bascode" localize="false">Sub example_datepart</paragraph>
+<paragraph id="par_idm1341576272" role="bascode" localize="false">    MsgBox DatePart("ww", #12/31/2005#)</paragraph>
+<paragraph id="par_idm1347516272" role="bascode" localize="false">    MsgBox DatePart(date:=#1999-12-30#, interval:="q")</paragraph>
+<paragraph id="par_idm1341575024" role="bascode" localize="false">End Sub</paragraph>
 </bascode>
-</body>
 
+</body>
 </helpdocument>
\ No newline at end of file


More information about the Libreoffice-commits mailing list