Home > atmlab > time > mjd2string.m

mjd2string

PURPOSE ^

MJD2STRING Converts a MJD value to a date string

SYNOPSIS ^

function s = mjd2string( mjd, onlyday )

DESCRIPTION ^

 MJD2STRING   Converts a MJD value to a date string

 FORMAT   s = mjd2string( mjd [, onlyday] )
        
 OUT   s          Date string.
 IN    mjd        Modified julian date. A single value.
 OPT   onlydate   Flag to not include hours, minutes and seconds. 
                  Default is false.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

mjd2string.m

SOURCE CODE ^

0001 % MJD2STRING   Converts a MJD value to a date string
0002 %
0003 % FORMAT   s = mjd2string( mjd [, onlyday] )
0004 %
0005 % OUT   s          Date string.
0006 % IN    mjd        Modified julian date. A single value.
0007 % OPT   onlydate   Flag to not include hours, minutes and seconds.
0008 %                  Default is false.
0009 
0010 
0011 % 2007-12-07   Created by Patrick Eriksson.
0012 
0013 
0014 function s = mjd2string( mjd, onlyday )
0015 %
0016 if nargin < 2,  onlyday = false; end
0017                                                     %&%
0018 rqre_datatype( mjd, @istensor0 );                   %&%
0019 rqre_datatype( onlyday, @isboolean );               %&%
0020   
0021   
0022 [year,month,day,h,m,s] = mjd2date( mjd );
0023 
0024 
0025 if ~onlyday
0026   s = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', year,month,day,h,m,s );
0027 else
0028   s = sprintf( '%04d-%02d-%02d', year,month,day );
0029 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005