时间格式的处理

来自Shiyin's note
Shen讨论 | 贡献2014年11月5日 (三) 01:31的版本
跳到导航 跳到搜索
  • 读入
year =0  & month = 0 & day = 0 ;初始化定义
Date='2012-02-21'
reads,Date,year,month,day,format='(I4,1x,I2,1x,I2)'
  • 儒略日计算
Jul=Julday(month,day,year,hour,minute,second)
  • 由儒略日计算date
CALDAT, Jul, Month [, Day [, Year [, Hour [, Minute [, Second]]]]]
  • 生成儒略日时间
MyTimes = TIMEGEN(365, UNITS="Days") + SYSTIME(/JULIAN)
MyTimes = TIMEGEN(12, UNITS="Months", START=JULDAY(1,1,2000))


  • 画图,时间坐标
label_date
例:  dummy = LABEL_DATE(DATE_FORMAT='%M%Z')
mytimes=timegen(12,unit='months,start=julday(1,1,2012))
y=findgen(12)
plot,mytimes,y,xtickformat='label_date'
DATE_FORMAT 格式
%M for month
%N for month (2 digit abbr)
%D for day of month,
%Y for 4 digit year.
%Z for last two digits of year.
%W for day of week
   For time:
%A for AM or PM
%H for Hours, 2 digits.
%I for minutes, 2 digits.
%S for Seconds, 2 digits.
%0--%9 following %S, indicates digits after decimal point.
%% is %
例子  '%D/%N/%Y' yields 11/12/1993
'%M!C%Y' yields DEC on the top line, 1993 on  the bottom (!C is the new line graphic command).