Message Boards Message Boards

0
|
7646 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

[?] Use the Absolute Time function with a list of dates/times?

Posted 6 years ago

Hello Wolfram community!

We are struggling to find a solution to the Absolute Time function. We would like to convert a list of dates (including the time of that day) into absolute time, but we always get an error message.

Do we need to do them all separately? If so, that would mean a lot of work for us...

Any help would be greatly appreciated!

POSTED BY: Joana Schenk
Posted 6 years ago

Because AbsoluteTime does not have the Listable attribute it does not automatically thread over lists. You can instead use Map (/@) to achieve converting a list of date-times to their absolute time value:

In[11]:= AbsoluteTime /@ {DateObject[{2018, 1, 19, 10, 16, 
    5.742317`7.511662151496675}, "Instant", "Gregorian", -6.`], 
  DateObject[{2018, 1, 20, 10, 16, 5.744265`7.511809454786524}, 
   "Instant", "Gregorian", -6.`], 
  DateObject[{2018, 1, 21, 10, 16, 5.744271`7.511809908415585}, 
   "Instant", "Gregorian", -6.`]}

Out[11]= {3.725345765742317*10^9, 3.725432165744265*10^9, 
 3.725518565744271*10^9}

If this doesn't answer a question, please post a sample of your code that demonstrates the error message.

POSTED BY: Kyle Martin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract