day of year from Igor dateTime object
izishaw
Hi all,
I am trying to see if there is a way to get the day of year (DOY) from an Igor DateTime wave.
Ideally I was hoping for something like secs2date(3636662400, option=DOY) gives 88.
https://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates
You could use something like this:
string strdate=Secs2Date(DateTime,-2)
variable yyyy=str2num(StringFromList(0, strdate,"-"))
variable mm=str2num(StringFromList(1, strdate,"-"))
variable dd=str2num(StringFromList(2, strdate,"-"))
return dateToJulian(yyyy, mm, dd) - dateToJulian(yyyy, 1, 1) + 1
end
March 29, 2019 at 02:46 am - Permalink
In reply to You could use something like… by tony
or this
variable secs
variable yyyy, mm, dd
sscanf Secs2Date(secs,-2), "%g-%g-%g", yyyy, mm, dd
return dateToJulian(yyyy, mm, dd)-dateToJulian(yyyy, 1, 1)+1
end
March 29, 2019 at 02:59 am - Permalink
I know it is late, but thank you for this :)
February 2, 2021 at 08:32 pm - Permalink