I am trying to do a plot of a time series with DateListPlot
. I want to feed it a time series I obtain from an SQL database. When I retrieve the time series the list is composed of SQLDateTime
entries that DateListPlot
doesn't understand.
In[24]:= t=SQLExecute[conn, "select timestamp,value from timeseries order by timestamp asc"]
Out[24]={{SQLDateTime[{2010,1,1}],12.3},{SQLDateTime[{2010,1,2}],12.51}}
Doesn't work:
In[25]:= DateListPlot[t]
DateListPlot
requires a Date tuple and doesn't understand SQLDateTime. What can I do?
SQLExecute[...] /. SQLDateTime[l_]:>l
orSQLExecute[...] /. SQLDateTime -> Identity
when you have multiple columns ofSQLDateTime
objects. Also,DateListPlot
understands integer Unix-style timestamps, so you could replaceSQLDateTime
withAbsoluteTime
to convert to those, sinceAbsoluteTime[{timespec...}]
gives you a timestamp. – Archivist