Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libreoffice Calc: date string to date/time values

I need to extract a 'date string' as separate columns representing date/time data.

 | A                        | B                 | C
-+--------------------------+-------------------+-----------------
1| Datetime String          | Date Value        | Time Value
2| Sat 09 Sep 2017 20:00 PM | =DATEVALUE(A2)    | =TIMEVALUE(A2)

The above functions DATEVALUE and TIMEVALUE return errors. I'm at a bit of a loss at the moment.

like image 482
Charles Goodwin Avatar asked Sep 04 '17 16:09

Charles Goodwin


1 Answers

It looks like the date string is fixed width, so use this formula for cell B2, which builds a date string in YYYY-MMM-DD format and then converts with DATEVALUE.

=DATEVALUE(MID(A2,12,4) & "-" & MID(A2,8,3) & "-" & MID(A2,5,2))

The formula for cell C2 only needs to extract the time, which is already in a suitable format.

=TIMEVALUE(MID(A2,17,5))

Then go to Format -> Cells, and format B2 as a date and C2 as a time.

like image 85
Jim K Avatar answered Oct 01 '22 14:10

Jim K