Importing Time Data
hegedus
I have some Excel data with a column of time stamps in the format "2016-06-12 08:39:12 PDT-0700". When I import into Igor it does so as text wave. How do I get it to recognize it as a time value?
Andy
Never Mind I got a work around. In Excel deleted " PDT-0700" and then Excel recognized it as numeric (it shifts the justification to right).
SplitString
Something like:
Wave /T wavewithtimes
Variable nTimes=numpnts(wavewithtimes)
Make/O /D /N=(nTimes) NewTimes
String olddate
String expr="([[:digit:]]+)\-([[:digit:]]+)\-([[:digit:]]+)T([[:digit:]]+)\:([[:digit:]]+)\:([[:digit:]]+)Z" // this was my case - need to edit for your format
String yr,mh,dy,hh,mm,ss
Variable i
For(i=0; i<nTimes; i+=1)
olddate=wavewithtimes[i]
SplitString /E=(expr) olddate, yr,mh,dy,hh,mm,ss
NewTimes[i]=date2secs(str2num(yr),str2num(mh),str2num(dy))+(3600*str2num(hh))+(60*str2num(mm))+str2num(ss)
EndFor
SetScale d 0, 0, "dat", NewTimes
Edit NewTimes
modifytable format=1
End
June 15, 2016 at 02:04 pm - Permalink