# Combining first 5 columns from CSV file into AbsoluteTime date

I need to import data from a CSV file that looks like :

I would like to convert the data into timestamps by creating a Table with 2 columns in Mathematica. The first column I would like to have a timestamp using AbsoluteTime that combines the year, month, day, hour, minute (for example: the first entry would be 2012-1-1 0:00 which then would be converted into absolutetime). The second column would have the DHI values.

I did this earlier for another data set that had two columns:

by using this code:

precip = Table[{AbsoluteTime[row[[1]]], row[[2]]}, {row, precip}];

prod["timestamp"] = AbsoluteTime[{#, {"Day", "MonthNameShort", "Year", "Hour24", "Minute", "Second"}}] & /@ prod["time"]


The problem I am having is taking each time entry from a row and putting them in one entry in a mathematica table.

(Also, excel screws with dates such as 2012-1-3 and turns them into 1/3/2012, so beware of that)

Thanks again for everything. I'm still pretty new to Mathematica. Your help is much appreciated.

• How are you trying to import your file? Feb 26, 2016 at 0:28
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Feb 26, 2016 at 2:16
• I am importing data using the import command, such as data = Import[ "***.csv"]; Feb 26, 2016 at 15:22

If dat contains your CSV import (with header row) and "Year" is your first column as in your screenshot then
{AbsoluteTime[#[[1 ;; 5]]], #[[6]]} & /@ Rest@dat