2015-10-19 10:47:23 -0700 to date and time usable by Numbers macOS

How can a date and time formatted as such "2015-10-19 10:47:23 -0700" be used in Numbers?


I want to plot data exported from iOS Health and this is the time format.


I have converted from XML to CSV.


Thank you for any suggestions.

iMac 27″ 5K, macOS 10.15

Posted on Apr 15, 2021 7:10 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 15, 2021 8:31 PM

To convert to a date-time string that Numbers can recognize you need to lop off the GMT offset at the end.


One way to do that is like this:





With the imported string in A2, the formula is this:


=LEFT(A2,LEN(A2)−6)+"0h"


The 0h is added so that Numbers treats the result as Date-Time rather than text. It will then become right-aligned by default.


Once you have the date-time strings in a column, "remove the formula" by selecting the cells, typing command-c to copy, followed by Edit > Paste Formula Results. Then you can delete the original imported values if you want and use the new column for your chart.


SG

5 replies
Question marked as Top-ranking reply

Apr 15, 2021 8:31 PM in response to SoCalMtnBiker

To convert to a date-time string that Numbers can recognize you need to lop off the GMT offset at the end.


One way to do that is like this:





With the imported string in A2, the formula is this:


=LEFT(A2,LEN(A2)−6)+"0h"


The 0h is added so that Numbers treats the result as Date-Time rather than text. It will then become right-aligned by default.


Once you have the date-time strings in a column, "remove the formula" by selecting the cells, typing command-c to copy, followed by Edit > Paste Formula Results. Then you can delete the original imported values if you want and use the new column for your chart.


SG

Apr 16, 2021 1:22 AM in response to SoCalMtnBiker

SoCalMtnBiker wrote:

Hadn't done any string manipulation in Numbers; but even if I had known how the coercing to time would have been beyond me. Does the +"0h" coerce it to time by adding 0 hours?


Yes, you could have added "0h" "0m" "0s" "0d", any of the shorthand for entering a Duration. When Numbers finds a string that looks like Date-time and is told to add a Duration to it, it is smart enough to know that you want a Date-Time as the result.


Here are some more ways you could have do the string manipulation:




SG



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

2015-10-19 10:47:23 -0700 to date and time usable by Numbers macOS

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.