Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> str2date() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    STR2DATE()

Purpose:     Convert date strings to a Clipper date type variable.

Syntax:      STR2DATE( datestring )

Arguments:   datestring  - Character date string to be converted.  The
                           string may be in either the long or short month
                           spelling format but in either case must be in
                           the general format of "January 31, 1990".

Returns:     A date variable corresponding to the date supplied in the
             string.  If the string is in an invalid format, an empty date
             ("  /  /  ") is returned.

Description: STR2DATE() is a character/date function used to translate
             dates which are expressed in spelled out form to Clipper date
             type variables.  A date that is expressed as Feb 28, 1990 is
             converted into a date type of 02/28/90.  This is useful when
             the need arises to convert dates which are stored in
             character format to date type fields.  Some software packages
             export date data in this character format.

Notes:       STR2DATE() is fairly robust and it can handle dates that omit
             the comma after the month.  If an invalid date string
             argument is given, STR2DATE() will set RLIBERROR() and return
             an empty date.

Example:     ? STR2DATE("Feb 1, 1990")        && Date value = 02/01/90
             ? STR2DATE("feb 01 90")          && Date value = 02/01/90


             *-- Example #2
             *-- Get data from an import text file from other software
             APPEND FROM textfile DELIMITED

             *-- date string is in field named StringDate
             *-- convert date in form Sep 10, 1988 to date variable
             REPLACE Startdate WITH STR2DATE(Stringdate)

Source:      RL_STR2D.PRG

See also:    ALPHADATE(), CALENDAR(), REVDATE()

See Also: ALPHADATE() CALENDAR() REVDATE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson