>  Docs Center  >  Libraries  >  JHU/APL/S1R  >  DATE2YMD






      Date text string to the numbers year, month, day.


Calling Sequence



      date = date string. in

Keyword Parameters


        /YMD Date is all numeric: Year, Month, Day
        /YDM Date is all numeric: Year, Day, Year
        /DMY Date is all numeric: Day, Month, Year
        /MDY Date is all numeric: Month, Day, Year
        /YDN Date is all numeric: Year, Day of year
        /DNY Date is all numeric: Day of year, Year
        /YYYY Make sure year is 4 digits.
        /YYMMMDD allows dates like 06jul25.
        /DDMMMYY allows dates like 25jul06.
        keywords is given.
        Dashes, commas, periods, or slashes are allowed.
        Some examples: 23 sep, 1985 sep 23 1985 1985 Sep 23
        23/SEP/85 23-SEP-1985 85-SEP-23 23 September, 1985.
        Doesn't check if month day is valid. Doesn't
        change year number (like 86 does not change to 1986)
        unless the /YYYY keyword is given. Non-numeric
        dates may have only 2 numeric values, year and day. If
        both year & day values are < 31 then day is assumed first.
        systime() can be handled: date2ymd,systime(),y,m,d
        For invalid dates y, m and d are all set to -1.
        Some example numeric dates: 051506, 05/15/06
        (May 15, 2006 with /YYYY), 05152006. All would use /MDY.


      y = year number. out
      m = month number. out
      d = day number. out

Common Blocks


      Notes: The format of the date is flexible except that the
        month must be month name unless one of the all numeric

Modification History

      Written by R. Sterner, 29 Oct, 1985.
      Johns Hopkins University Applied Physics Laboratory.
      25-Nov-1986 --- changed to REPCHR.
      RES 18 Sep, 1989 --- converted to SUN.
      R. Sterner, 1994 Mar 29 --- Modified to handle arrays.
      R. Sterner, 2005 Jan 02 --- Allowed all numeric dates. Also may
      convert from 2 to 4 digit year.
      R. Sterner, 2006 Jun 07 --- Allowed dates like 051506.
      R. Sterner, 2006 Jul 25 --- Added /YYMMMDD for dates like 06jul25.
      Added /DDMMMYY for dates like 25jul06.
      R. Sterner, 2007 Jan 04 --- Made for loop index long.
      R. Sterner, 2010 Jan 18 --- Allowed 4 digit years with /yymmmdd and /ddmmmyy
      R. Sterner, 2010 Apr 29 --- Converted arrays from () to [].
      R. Sterner, 2010 Jun 17 --- Added /YDN and /DNY keywords.
      R. Sterner, 2011 Apr 07 --- Punctuation removal now gets it all.
  Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
  This software may be used, copied, or redistributed as long as it is not
  sold and this copyright notice is reproduced on each copy made. This
  routine is provided as is without any express or implied warranties
  whatsoever. Other limitations apply as described in the file disclaimer.txt.

© 2022 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us