Home > pointing > utc2date.m

utc2date

PURPOSE ^

function date=utc2date(utc)

SYNOPSIS ^

function date=utc2date(utc)

DESCRIPTION ^

 function date=utc2date(utc)

 give a sensible date from the utc, which is MJD

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function date=utc2date(utc)
0002 % function date=utc2date(utc)
0003 %
0004 % give a sensible date from the utc, which is MJD
0005 
0006 % subtract off Jan 1, 2000
0007 utc=utc-51543;
0008 date.year=floor(utc/365.24)+2000;
0009 day=utc-floor(utc/365.24)*365.24;
0010 
0011 md=[31 28 31 30 31 30 31 31 30 31 30 ...
0012       31];
0013 months={'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'};
0014 
0015 for m=1:12
0016   day=day-md(m);
0017   if day<0
0018     break
0019   end
0020 end
0021 date.month=char(months(m));
0022 
0023 date.day=floor(day)+md(m);
0024 
0025 subday=day-floor(day);
0026 date.hour=floor(subday*24);
0027 subhour=24*subday-floor(24*subday);
0028 date.min=floor(subday*60);
0029 submin=60*subhour-floor(60*subday);
0030 date.sec=floor(subday*60);
0031 
0032 return
0033 
0034

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005