From 3144ec5695574689ffd32dcef7b7b7a29e63dbf9 Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Mon, 24 Jan 2022 18:38:21 +0100 Subject: tdf#146911 Improve Basic DateValue description Change-Id: I41cbd011f753796b45556c5cf33e5fa93f6e7461 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/128818 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- source/text/sbasic/shared/03030102.xhp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'source/text/sbasic') diff --git a/source/text/sbasic/shared/03030102.xhp b/source/text/sbasic/shared/03030102.xhp index f2801d80cf..aea6339a0c 100644 --- a/source/text/sbasic/shared/03030102.xhp +++ b/source/text/sbasic/shared/03030102.xhp @@ -1,5 +1,5 @@ - + - DateValue Function @@ -34,28 +33,41 @@ DateValue function

DateValue Function

- Returns a date value from a date string. The date string is a complete date in a single numeric value. You can also use this serial number to determine the difference between two dates. + Returns a Date object from a string representing a date. + The returned object is represented internally as a single numeric value corresponding to the specified date. This value can be used to calculate the number of days between two dates. - DateValue(date) + DateValue(date As String)
- Date: String expression that contains the date that you want to calculate. In contrast to the DateSerial function that passes years, months and days as separate numeric values, the DateValue function requests the date string to be according to either one of the date acceptance patterns defined for your locale setting (see %PRODUCTNAME - PreferencesTools - Options - Language Settings - Languages) or to ISO date format (momentarily, only the ISO format with hyphens, e.g. "2012-12-31" is accepted). + date: A string that contains the date that will be converted to a Date object. + The string passed to DateValue must be expressed in one of the date formats defined by your locale setting (see %PRODUCTNAME - PreferencesTools - Options - Language Settings - Languages) or using the ISO date format "yyyy-mm-dd" (year, month and day separated by hyphens).
-The computed date.i66764 +Date. - Sub ExampleDateValue - MsgBox DateValue("23/02/2011") - End Sub + Sub ExampleDateValue + Dim aDate As Date + aDate = DateValue("2021-12-20") + ' Prints the localized date + MsgBox aDate + ' Extracts the year, month and day from the date object + MsgBox Year(aDate) + MsgBox Month(aDate) + MsgBox Day(aDate) + ' Prints the numeric value corresponding to the date (as Long type) + MsgBox CLng(aDate) + End Sub +
+ +
- -- cgit