source: trunk/SRC/Calendar/jul2date.pro @ 227

Last change on this file since 227 was 227, checked in by smasson, 17 years ago

bugfix in path usage and calendar accuracy

  • Property svn:keywords set to Id
File size: 896 bytes
Line 
1;------------------------------------------------------------
2;+
3;
4; @file_comments
5; gives yyyymmdd date equivalent of a Julian day
6;
7; @categories
8; Calendar
9;
10; @param jday {in}{required}
11; Julian day
12;
13; @returns
14; date in yyyymmdd format
15;
16; @examples
17;
18; IDL> print, jul2date(julday(12,23,1999))
19;        19991223
20;
21; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
22;                       June 2005
23;
24; @version $Id$
25;
26;-
27;------------------------------------------------------------
28function jul2date, jday
29;
30  compile_opt idl2, strictarrsubs
31;
32  caldat, jday, month, day, year, hour, min, sec
33;
34  res = (10000L*year + 100L*month + day)*(year GE 0) $
35        +( 10000L*year - 100L*month - day)*(year LT 0)
36;
37  IF total([hour NE 12, min NE 0, abs(sec) GE 1.e-4]) EQ 0 THEN return, long(res) $
38  ELSE return, double(res) + (hour / 24.0d0) + (min/1440.0d0) + (sec / 86400.0d0)
39
40end
Note: See TracBrowser for help on using the repository browser.