Changeset 522 for trunk/libIGCM/libIGCM_date/libIGCM_date.ksh
- Timestamp:
- 12/02/11 19:17:07 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_date/libIGCM_date.ksh
r435 r522 159 159 160 160 IGCM_debug_PopStack "IGCM_date_GetYearMonth" 161 } 162 163 #================================================================== 164 function IGCM_date_GetYearMonthDay 165 { 166 IGCM_debug_PushStack "IGCM_date_GetYearMonthDay" $@ 167 168 # from a yyyymmdd date format return 169 # a yyyy year, mm month and dd day 170 # usage IGCM_date_GetYearMonthDay yyyymmdd year_var month_var day_var 171 172 # if there is no argument on the command line, 173 # then assume that a yyyymmdd formated date is being 174 # piped in 175 typeset dt 176 if [ $# = 0 ] 177 then 178 read dt 179 else 180 dt=$1 181 fi 182 183 # break the yyyymmdd into separate parts for year, month and day 184 eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 185 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" ) 186 eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 187 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" ) 188 eval $4=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 189 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\3/" ) 190 191 IGCM_debug_PopStack "IGCM_date_GetYearMonthDay" 161 192 } 162 193
Note: See TracChangeset
for help on using the changeset viewer.