root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/timefun/hms2h.m
Revision 495 (checked in by cbc, 12 years ago) |
---|
Line | |
---|---|
1 | function [hours]=hms2h(h,m,s); |
2 | %HMS2H converts hours, minutes, and seconds to hours |
3 | % |
4 | % Usage: [hours]=hms2h(h,m,s); or [hours]=hms2h(hhmmss); |
5 | % |
6 | if nargin== 1, |
7 | hms=h; |
8 | h=floor(hms/10000); |
9 | ms=hms-h*10000; |
10 | m=floor(ms/100); |
11 | s=ms-m*100; |
12 | hours=h+m/60+s/3600; |
13 | else |
14 | hours=h+(m+s/60)/60; |
15 | end |
Note: See TracBrowser for help on using the browser.