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


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 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)))

Regarding DATEVALUE, it converts a string into a date value, but you have to take care of the date format if you do not use ISO. So you have to define the date pattern, (menu) - Tools - Language Settings - Languages at "Date acceptance patterns".

Already Miguel Ángel pointed this out, that the fields in the date could be wrong, e.g. English (USA), and he was right. I have not succeeded in modifying the pattern field directly, despite this should be possible according to help. But to change the "Local setting" three lines above worked fine. Now the default setting in this field is "English (USA)" with the attached pattern M/D/Y while we need D/M/Y. This is the standard for English (UK). With this done, all worked fine for me in my testing.

Regarding the setting (menu) - Format - Cells: This applies just for the "converted" cell, how the date shall be presented, and there you can chose anything you want, the default English (UK) (which you chose above), German (Germany) which gives the ISO standard, or anything you want. This formatting must not be applied to the cell where the original date is (e.g. cell A1). That cell should be formatted as text.

Kaj

Am 2015-03-24 02:16, Andreas Säger schrieb:
Am 20.03.2015 um 12:21 schrieb Kaj:
No, this won't work. You've got to change the global locale option in
order to change the evaluation context for existing data.

Other method: =DATE(RIGHT(A1,4),MID(A1,4,2),LEFT(A1,2))



Do you have the used date pattern defined? Look at (menu) - Tools -
Language Settings - Languages at "Date acceptance patterns".


OK, I installed the latest LibreOffice and tested
=VALUE("20-03-1999") => Err:502 (invalid argument)
Then I added date pattern D-M-Y which did not change anything.

The one and only relevant setting for the conversion of already existing
text is the global application locale above "date acceptance patterns"
in the language options.




--
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.