Home > atmlab > time > jd2jdate.m

jd2jdate

PURPOSE ^

JD2JDATE Julian day number to Julian calendar date.

SYNOPSIS ^

function [year, month, day, hour, minute, second] = jd2jdate(jday)

DESCRIPTION ^

JD2JDATE Julian day number to Julian calendar date.

   [YEAR, MONTH, DAY, HOUR, MINUTE, SECOND] = JD2JDATE(JDAY) returns the
   Julian calendar date (year, month, day, hour, minute, and second)
   corresponding to the Julian day number JDAY.

   Start of the JD (Julian day) count is from 0 at 12 noon 1 JAN -4712
   (4713 BC), Julian proleptic calendar.  Note that this day count conforms
   with the astronomical convention starting the day at noon, in contrast
   with the civil practice where the day starts with midnight.

   Astronomers have used the Julian period to assign a unique number to
   every day since 1 January 4713 BC.  This is the so-called Julian Day
   (JD). JD 0 designates the 24 hours from noon UTC on 1 January 4713 BC
   (Julian calendar) to noon UTC on 2 January 4713 BC.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

jd2jdate.m

SOURCE CODE ^

0001 function [year, month, day, hour, minute, second] = jd2jdate(jday)
0002 %JD2JDATE Julian day number to Julian calendar date.
0003 %
0004 %   [YEAR, MONTH, DAY, HOUR, MINUTE, SECOND] = JD2JDATE(JDAY) returns the
0005 %   Julian calendar date (year, month, day, hour, minute, and second)
0006 %   corresponding to the Julian day number JDAY.
0007 %
0008 %   Start of the JD (Julian day) count is from 0 at 12 noon 1 JAN -4712
0009 %   (4713 BC), Julian proleptic calendar.  Note that this day count conforms
0010 %   with the astronomical convention starting the day at noon, in contrast
0011 %   with the civil practice where the day starts with midnight.
0012 %
0013 %   Astronomers have used the Julian period to assign a unique number to
0014 %   every day since 1 January 4713 BC.  This is the so-called Julian Day
0015 %   (JD). JD 0 designates the 24 hours from noon UTC on 1 January 4713 BC
0016 %   (Julian calendar) to noon UTC on 2 January 4713 BC.
0017 
0018 %   Sources:  - http://tycho.usno.navy.mil/mjd.html
0019 %             - The Calendar FAQ (http://www.faqs.org)
0020 
0021 %   Author:      Peter J. Acklam
0022 %   Time-stamp:  2002-05-24 15:24:45 +0200
0023 %   E-mail:      pjacklam@online.no
0024 %   URL:         http://home.online.no/~pjacklam
0025 
0026    nargsin = nargin;
0027    error(nargchk(1, 1, nargsin));
0028 
0029    ijday = floor(jday);                 % integer part
0030    fjday = jday - ijday;                % fraction part
0031 
0032    second = 86400 * fjday;
0033    hour   = floor(second / 3600);         % get number of hours
0034    second = second - 3600 * hour;         % remove the hours
0035    minute = floor(second / 60);           % get number of minutes
0036    second = second - 60 * minute;         % remove the minutes
0037    hour   = hour + 12;                  % Julian days start at noon
0038 
0039    % The following algorithm is from the Calendar FAQ.
0040 
0041    b = 0;
0042    c = ijday + 32082;
0043 
0044    d = floor((4 * c + 3) / 1461);
0045    e = c - floor((1461 * d) / 4);
0046    m = floor((5 * e + 2) / 153);
0047 
0048    day   = e - floor((153 * m + 2) / 5) + 1;
0049    month = m + 3 - 12 * floor(m / 10);
0050    year  = b * 100 + d - 4800 + floor(m / 10);

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