This page was created by the IDL library routine mk_html_help2.

Last modified: Wed Feb 14 14:08:15 2007.


Directory Listing of Routines


Routine Descriptions

DATESEC

[Next Routine] [List of Routines]
 FUNCTION:
 	 DATESEC

 DESCRIPTION:

	function to parse out a date string of either the form [YY]YY-MM-DD 
	(e.g. '1989-10-1' or '89-10-1), DD/MM/YY (e.g. '1/10/89'), DD MMM YY
	(e.g. '1 Oct 89' or '1 OCT 89', case ingnored) or YYYY/MM/DD 
	(e.g. 1989/10/01, where the first field is greater than 31).  The
	RETURN value is double float in seconds since 1 Jan 1970, 00:00 UT.

 USAGE (SAMPLE CODE FRAGMENT):
 
    
    ; seconds since 1970 

	string_date = '21 Mar 91'
    
    ; convert to string    
    
	seconds_date = datesec(string_date)
    
    ; print it out
    
	PRINT, seconds_date

 --- Sample output would be 
    
	6.6951720e+08
    

 NOTES:

	If conversion fails, this function returns -1.

	For the forth input format to work (YYYY/MM/DD), the year
	specified must be greater than 31, otherwise the DD/MM/YY
	format assumed.

 	Note that NO combination of of input formats will work.  Also, all
 	three fields must be present.  

	If any of the fields is to large then a carry operation will occur.  
 	i.e. 34/13/89 would come out to year 90, month 2, day 3.

	If input seconds is an array, then an array of 
	N_ELEMENTS(inputs vals) of date strings and remainders will be returned.


 REVISION HISTORY:

	@(#)datesec.pro	1.6 08/17/95 	
 	Originally written by Jonathan M. Loran,  University of 
 	California at Berkeley, Space Sciences Lab.   Sep. '91

	Revised to handle arrays of input values, JML, Jan. '92

(See themis/spacecraft/fields/scm/datesec.pro)


SECDATE

[Previous Routine] [Next Routine] [List of Routines]
 FUNCTION:
 	 SECDATE

 DESCRIPTION:

	function to return a date string from the number of seconds since
	1970, Jan. 1 00:00.  Output format is controled by the keyword
	FMT.  This function will return a string in the format:
 	
	FMT=0 		YYYY-MM-DD  		(e.g. "1991-03-21");   
	FMT NE 0 	DD MMM YY  		(e.g. " 3 Mar 91");   

	In addition, the remander in seconds of the day are returned through
	the remainder formal, which can be used in a subsiquent call to the 
	function sectime if the full representation of time in date/time is
 	desired.

 USAGE (SAMPLE CODE FRAGMENT):
 
    
    ; seconds since 1970 

	seconds_date = 6.6951720e+08           ; 21 Mar 91, 01:00:00.000
    
    ; convert to string    
    
	date_string = secdate(seconds_date,remainder, FMT=0)
    
    ; print it out
    
	PRINT, date_string, remainder

 --- Sample output would be 
    
	1991-03-21, 3600.
    
 KEYWORDS:

	FMT	Controls the output string format.  See description above.

 NOTES:

	The seconds and remainder parameters should be double precision.

	If seconds is given negitive, this is an error and the string 'ERROR' is 
	returned.

	If seconds is greater than 5e9, this is past the year 2100,
	and this is considered an error, and 'ERROR' is returned. 
	(I hope this code doesn't last past the year 2100!)

	If input seconds is an array, then an array of 
	N_ELEMENTS(inputs vals) of date strings and remainders will be returned.

 	Credits: adapted from The C Programming Lanuage, by Kernighan and 
 	Ritchie, 2nd Ed. page 111

 REVISION HISTORY:

	@(#)secdate.pro	1.6 02/10/97 	
 	Originally written by Jonathan M. Loran,  University of 
 	California at Berkeley, Space Sciences Lab.   Sep. '91

	Revised to handle arrays of input values, JML, Jan. '91
 
 	Revised to check for time too large.  Before it would
	go into a rediculously long loop finding the year.

       Just convert do loop indice in LONG format at line 128,
       P. Robert, sept. 2006

(See themis/spacecraft/fields/scm/secdate.pro)


SECTIME

[Previous Routine] [Next Routine] [List of Routines]
 FUNCTION:
 	 SECTIME

 DESCRIPTION:

	function to return a time string from time of day given in seconds---
	Given an input time in the seconds of the day, this function will
	return a string in the format:

		HH:MM:SS.MSC

 USAGE (SAMPLE CODE FRAGMENT):
 
    
    ; seconds of the day

	seconds_day = 43200.00           ; 12 noon    
    
    ; convert to string    
    
	time_string = sectime(seconds_day)
    
    ; print it out
    
	PRINT, time_string

 --- Sample output would be 
    
	12:00:00.000
    

 NOTES:

	The seconds parameter should be of a floating point type (i.e float
	or double)                                                                  

	If the input is greater than 86400. (24 hours), time will be subtracted
	in 24 hour chunks, until the time is less than 24 hours.

	If seconds is given negative, this is an error and the string 'ERROR' is     
	returned.                                                                    

	If input seconds is an array, then an array of 
	N_ELEMENTS(inputs vals) of time strings will be returned.


 REVISION HISTORY:

	@(#)sectime.pro	1.2 06/30/95 	
 	Originally written by Jonathan M. Loran,  University of 
 	California at Berkeley, Space Sciences Lab.   Sep. '91

	Revised to handle arrays of input values, JML, Dec. '91
       Added "carry" to seconds, S. Claflin, June, 97.

(See themis/spacecraft/fields/scm/sectime.pro)


TIME_TO_STR

[Previous Routine] [List of Routines]
 FUNCTION:
 	 TIME_TO_STR

 DESCRIPTION:

	function to return a date-time string from the number of seconds since
	1970, Jan. 1 00:00.  Output format is controled by the keyword
	FMT.  This function will return a string in the format:
 	
	FMT=0 	 YYYY-MM-DD/HH:MM:SS.MSC   (e.g. "1991-03-21/10:35:22.156");   
	FMT NE 0 DD MMM YY HH:MM:SS.MSC    (e.g. " 3 Mar 91 10:35:22.156");   

 USAGE (SAMPLE CODE FRAGMENT):
 
    
    ; seconds since 1970 

	seconds_date_time = 6.6951720e+08           ; 21 Mar 91, 01:00:00.000
    
    ; convert to string    
    
	date_time_string = time_to_str(seconds_date_time, FMT=0)
    
    ; print it out
    
	PRINT, date_time_string

 --- Sample output would be 
    
	1991-03-21/10:35:22.156
    
 KEYWORDS:

	FMT	Controls the output string format.  See description above.
       MSEC    returns string with millisec accuracy if set.

 NOTES:

	The seconds parameter should be double precision.

	If seconds is given negitive, this is an error and the string 'ERROR'
	is returned.

	If input seconds is an array, then an array of 
	N_ELEMENTS(inputs vals) of date strings will be returned.

	This function relies upon the secdate and sectime functions

 	Credits: adapted from The C Programming Lanuage, by Kernighan and 
 	Ritchie, 2nd Ed. page 111

 REVISION HISTORY:

	@(#)time_to_str.pro	1.1 31 Jul 1995
 	Originally written by Jonathan M. Loran,  University of 
 	California at Berkeley, Space Sciences Lab.   Jul. '95

(See themis/spacecraft/fields/scm/time_to_str.pro)