Calculating time difference
Hi,
I am trying to calculate the difference between two times. Both variables are currently stored as string. So I'm assuming I need to convert from string to time. How do I do this please? And then I will apply the subtract function.
Baz
-
Hi Baz,
You'll want to use the ASDATE function to convert from string to date type. You'll need to use a Parse Pattern to convert your string.
Here's the full Datameer Functions reference page, so you can look up the various functions.
Alan
-
Hi Baz,
Yes all dates are calculated from epoch time, in milliseconds and then displayed according to their parse pattern.
If the data only includes a timestamp, and not the full date, you'll need to add a datestamp to it with a concatenation function first.
This, of course, assumes the timestamps are all from the same day. Since without a full datestamp you can't tell if two timestamps are separated by multiple days. 12:00pm and 12:01pm can look like a 1 minute difference, but if the two timestamps occur on separate days, we're dealing with 24 hours and 1 minute now.
Alan
Please sign in to leave a comment.
Comments
3 comments