Date not formatting after Concatenate

Guys my Date and Time data is not formatting correctly after Concatenating. I attach a sample file here with explanation.
I have tried this in ods, .xlsx and .csv to no avail?
Hopefully someone can see where I am going wrong?
Thank you
Just updated to 7.5.4.2

Concatenate date and time columns.ods (15.0 KB)

“Formatting”? if you mean “bold, italic, color, font, font size, … etc…” format properties, then - you need know it - it will not work with the CONCATENATE function. The function can concatenate the unformatted data only, but not the formatting properties even if they are created by cell style or manually.
You must format the cell of the result again: by style or manually. You can not format differently the two original part of the result of a CONCATENATE function. And it will not work with any cell function.

There is not any sample file attached yet.

Why CONCATENATE? Why not add them? They are not numeric data in your file? (The “combine format properties” won’t work with that either. You need use an another cellstyle for format the result cell.)

1 Like

Zizi64 I have loaded the file after a few PC problems here. Maybe you could take a look?

Concatenate date and time columns Zizi64.ods (14.0 KB)

1 Like

Note that CONCATENATE(45084;0.562939814814815) gives
450840.56…, not
45084.56…

1 Like

Leroy
Yes I had noted that it seems to add a 0 but not sure of this significance?
Could you enlighten me if you have a moment🤔
I have done this once before successfully without the need to the other steps so not sure what is happening?

Ziti thank you for your response and advice. I will try that tomorrow when I get to my PC :pray:

CONCATENATE() is a function expecting text arguments and returning text value. “45084” is converted from integer to string, no problem here. “0.562939…” is a floating number which is internally stored as IEEE-754 already has some differences between your human-readable entry and its binary form. This binary form is then converted to string, discarding some “non-sensical” digits at the end. We can assume this string begins with “0.5629”. Concatenating both strings gives “450840.5629” (as dictated by CONCATENATE() specification). The function has not reason to discard characters in both strings. If it did, it would be severely faulty.

What this means is your real intent is to add a time-of-day (fractional part) to a day date (integer part). Do this as 45084 + 0.5629… (replacing the literal numbers by the cell name where they are computed) instead of trying to concatenate supposed date/time strings which exist only after display is triggered and only on screen.

1 Like

This has nothing to do with “formatting”. It is a matter of the data type being either number or text. Number format codes do not apply to text. The result of a concatenation is always a text.
menu:View>Highlight Values (Ctrl+F8) reveals if a cell contains a constant number (blue) or text (black). The label in D1 and E1 says “formatted as Text”. But the values below are numbers. You can not convert any data type into another by mere formatting. Formatting always displays the exact same value one way or the other without changing the value. The values become text as result of the concatenation. Spreadsheets deal with numbers. You should simply add up the 2 numbers and apply any number format to the resulting number.

1 Like

Seriously it as simple as that, unbelievable. I am not sure how I got to trying this complicated incorrect way when all I have to do is add say B1+B2 then copy down my list. Problem solved.
Thank you to ALL who responded to my query, much appreciated.

See also: IsDate function not directly available in LO calc 7.1.2.2 (EN)? - #6 by Villeroy
When you add numbers 3 and 0.75 and format the resulting number 3.75 as date with time, you see something like

  • 1900-01-02 18:00:00
  • 2 January 1900 6 PM
  • January 2 1900 6 PM (US style)

All these formattings represent the same value 3.75 which is day number 3 plus 3/4 of a day.

All three text values

  • 1900-01-02 18:00:00
  • 2 January 1900 6 PM
  • January 2 1900 6 PM

are different from each other. They are different sequences of characters and no border, color, font or number format will turn them into numbers.

Thank you I continue to learn from all of the helpful people here who are generous with their knowledge. It is much appreciated.:pray: