Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Am 2015-03-24 18:22, Andreas Säger schrieb:
Am 24.03.2015 um 14:22 schrieb Kaj:
Hi !

Now you happened to use the wrong conversion function, VALUE instead of
DATEVALUE, so of course it did not work. But even with the correct
function there seems to be some issues. According to the help text for
the date acceptance pattern: besides local ways to write date, also the
ISO standard is supported. This standard says that dates are written,
like all numbers in the decimal system, with most significant values to
the left and least significant figures to the right. Hence dates are
written "YYYY-MM-DD". I tested this in my computer and it worked very
well. Conversely I had no success with the format DD/MM/YYYY despite I
had introduced this as a pattern.

I also tested some string manipulation to convert the string like this
=DATEVALUE(CONCATENATE(RIGHT(A1,4),"-",MID(A1,4,2),"-",LEFT(A,2)))
and so does =VALUE(CONCATENATE(RIGHT(A1,4),"-",MID(A1,4,2),"-",LEFT(A,2)))

and that worked fine too. However this is much the same as using the
DATE function, proposed earlier by you Andreas:
     =DATE(RIGHT(A1,4),MID(A1,4,2),LEFT(A1,2))

BUT! wrong! The DATE function converts numbers into a date value, so you
have to convert the strings into numbers. Thus:
     =DATE(VALUE(RIGHT(A4,4)),VALUE(MID(A4,4,2)),VALUE(LEFT(A4,2)))

Wrong. The DATE function calculates one integer day number from 3
numbers year, month and day.
Without VALUE(), =DATE(RIGHT(A4,4),MID(A4,4,2),LEFT(A4,2)) works as well
because Calc implicitly converts integer numerals (strings consisting of
digits only).
Not wrong, but possibly not fully exhaustive. Did I mention how many numbers that were input for the conversion? If my eyes are still working as expected I read the word "numbers" (plural) when describing the main procedure. Well, in one aspect I have to admit I was not fully informed. I was not aware of the implicit conversion of strings containing numbers into numbers. Good to know. However, despite this, I prefer to define this conversion explicitly to have full control and not being surprised at some possible change in the future.

There are no "date values" in spreadsheets. 0 formatted as date gives
1899-12-30, 36526 formatted as date gives 2000-01-01. Both values, the
"date value" and the integer are the exact same value displayed in
different number formats like you can display them in different fonts,
colors or sizes.
Well, you call them date numbers, and that is ok for me. But as they are not just any, but defined as the number of days passed after 1899-12-30, I cannot see anything wrong in calling them date value. And moreover they are not simple integers, since the time of day is included as a decimal part, just the way you describe in the next paragraph. Did you think I do not know that?

If the value is an integer day number without time, VALUE and DATEVALUE
return the exact same day number.

In English notation with point as decimal separator and comma as list
separator:
=VALUE("2000-1-1 12:00") => 36526.5 (full day number with time)
=DATEVALUE("2000-1-1 12:00") <=> INT(VALUE("2000-1-1 12:00")) => 36526
(integer day number only cutting of the time fraction of the day)
TIMEVALUE("3.14159") <=> MOD(VALUE("3.14159"),1) => 0.5 (the fraction of
the day cutting off the integer day number).


All this conversion from strings to numbers is unrelated to the date
acceptance patterns that determines how Calc turns your keyboard input
into day numbers.




--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.