Thanks. I only need to have some loose idea, so precision to the day is more than enough. I have several decades of sampling data and I just want to see the date in the middle.

BTW, once I get the average datenumber, how do I convert it back to Date? I tried the below and it did not work well.

A = Date(2001,12,5);
B = Dates.value(A); # get the date number
C = Dates.Date(B); # Trying to convert the date number back to date.

I think you’re looking for unix2datetime and datetime2unix (which takes a DateTime). Julia has proper datetime arithmetic built in, so you should not have to work with the raw values.

Maybe you can explain what you want to do with them?

I have several decades of sampling data. They have date information stored as 3 separate columns: Year, Month, and Day. What I need to find out is the average date.

Are you talking about the median, geometric or arithmetic mean…? How do you want to round, in case you don’t get an even integer (truncation, towards/away from zero, towards positive/negative infinity, …)?

Sorry if I come across as intrusive, it’s just hard for me to give a concrete suggestion when I’m not clear what you’re talking about

My variables are changing smoothly with time. I want to find out the average date value so that I can adjust all data to that date. I think what I need is the arithmetic mean? I can round the results, so that shouldn’t be a problem. For this post, I just want to find out how to convert a date number like 730824 back to a date or its original Year, Monty and Day. Thanks.