Time stamp conversion Day of Year to Date and Time
LaMP
What is the function used to convert an IGOR time stamp from DOY (Day of Year) with hourly times to "date + time (Hourly)".
I attached an example that starts from Jan 1 2017.
Thanks very much.
•dates = Date2Secs(2017, 1, 1)+86400*DOY
The wave DOY was made by copying your text and pasting into an Igor table. In the attached picture of an Igor table, I set the format of the "dates" column by right-clicking and selecting Format->Date and Time.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 24, 2017 at 09:34 am - Permalink
Your file starts like this:
DOY 366.958 1 1.04167 1.08333
None of these are IGOR time stamps. Igor stores date/time values as seconds since 1904-01-01.
It is not clear to me what the meaning of 366.958 is so I will ignore it for now.
Assuming that you have loaded the values in the file starting from "1" into wave0, here are some useful commands:
Duplicate wave0, wave1
Redimension/D wave1 // Date/time values must be double-precision
SetScale d, 0, 0, "dat", wave1 // "dat" data units tells Igor that the wave contains date/time values
Variable startDateTime = date2secs(2017, 1, 1)
wave1 = FractionalHoursToDateTime(startDateTime, wave0)
AppendToTable wave1
FractionalHoursToDateTime is defined as follows:
Variable startDateTime // In Igor date/time format (seconds since 1904-01-01)
Variable fractionalHours
Variable secondsPerHour = 60 * 60
Variable seconds = fractionalHours * secondsPerHour
Variable dt = startDateTime + seconds
return dt // An Igor date/time value
End
January 24, 2017 at 09:41 am - Permalink
Thank you both very much for your replies.
The suggestion of John worked for this case.
The first digit of each row corresponds to the day of year and the remaining digits correspond to the fractional time.
Best regards
January 24, 2017 at 11:30 pm - Permalink