Path: news.mathworks.com!not-for-mail
From: "Steve " <steveDEL.bachmeierDEL@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: daylight savings adjustment
Date: Wed, 1 Aug 2007 18:45:25 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 41
Message-ID: <f8qkc5$pka$1@fred.mathworks.com>
References: <f8qh9a$l69$1@fred.mathworks.com> <f8qivq$dlm$1@canopus.cc.umanitoba.ca>
Reply-To: "Steve " <steveDEL.bachmeierDEL@yahoo.com>
NNTP-Posting-Host: webapp-00-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1185993925 26250 172.30.248.35 (1 Aug 2007 18:45:25 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 1 Aug 2007 18:45:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1034320
Xref: news.mathworks.com comp.soft-sys.matlab:422086



The dates are in Excel as 'd/m/yyyy'.  I transferred to Matlab and converted as follows:

------

[datanum datatxt dataraw]=xlsread('filename');

dates=datatxt(3:end,1);  %These are of form 'd/m/yyyy'

tdst=cell2mat(dataraw(3:end,2))*24;  %Converts times from form '3:00 PM' to form '15'

------

Now I need to take the 'tdst' values (daylight saving times) and subtract 1 - but only between the dates/times 2:00 AM on the second Sunday in March and 2:00 AM on the first Sunday in November.  The problem is that these datenums change, and so I'm currently trying to hunt down the dates using something like 

for time=t'
march{time}=calendar(year(time),3);
november{time}=calendar(year(time),11);
startDSTloc=march(find(min(march(:,1)>0))+1,1);
endDSTloc=november(find(min(november(:,1)>0)),1);
end

Then I'd somehow specifiy tstd=tdst-1 only for tdst between '3/march(startDSTloc,1)/year 2:00AM' and '11/november(endDSTloc,1)/year 2:00AM'.

Any suggestions?  Thanks.

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in message <f8qivq$dlm$1@canopus.cc.umanitoba.ca>...
> In article <f8qh9a$l69$1@fred.mathworks.com>,
> Steve  <steveDEL.bachmeierDEL@yahoo.com> wrote:
> >I have several years' worth of hourly data in Excel.  Times are given
> >and they take into account daylight saving.  How can I locate all of
> >the time data that is affected by daylight saving (as of 2007, it
> >starts at 2:00 AM on the second Sunday in March and ends at 2:00 AM on
> >the first Sunday in November) and subtract one hour from the values?
> 
> How are the times encoded?
> 
> datenum and datevec might be of assistance.
> -- 
>   "law -- it's a commodity"
>                          -- Andrew Ryan (The Globe and Mail, 2005/11/26)