home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / stod.c < prev    next >
C/C++ Source or Header  |  1993-10-14  |  2KB  |  64 lines

  1. /*
  2.  * File......: STOD.C
  3.  * Author....: Dave Pearson
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Dave Pearson
  7.  * Date......: 30/03/93
  8.  * Revision..: 1.0
  9.  *
  10.  * This is an original work by Dave Pearson and is placed in the public
  11.  * domain.
  12.  *
  13.  * Modification history:
  14.  * ---------------------
  15.  *
  16.  * $Log$
  17.  *
  18.  */
  19.  
  20. // NOTE: This code has been written for and compiled with Borland C++
  21. //       Version 3.1
  22. //
  23.  
  24. #include <Extend.H>
  25.  
  26. /*  $DOC$
  27.  *  $FUNCNAME$
  28.  *      GT_STOD()
  29.  *  $CATEGORY$
  30.  *      Date
  31.  *  $ONELINER$
  32.  *      Convert a YYYYMMDD string to a Clipper date.
  33.  *  $SYNTAX$
  34.  *      GT_SToD(<cDateString>) --> dClipperDate
  35.  *  $ARGUMENTS$
  36.  *      <cDateString> is a string in the same format as that returned by
  37.  *      the Clipper function dtos(). The format is "YYYYMMDD" where "YYYY"
  38.  *      is the year, "MM" is the month and "DD" is the day.
  39.  *  $RETURNS$
  40.  *      A Clipper date.
  41.  *  $DESCRIPTION$
  42.  *      GT_SToD() can be used to convert a string date into a Clipper date
  43.  *      variable. This is of use if you wish to hard code a date into a
  44.  *      program but you don't know what date format will be used.
  45.  *  $EXAMPLES$
  46.  *      set date    british
  47.  *      set century off
  48.  *      dDate := GT_SToD("19671209")
  49.  *      ? dDate                         // Prints `09/12/67'
  50.  *  $END$
  51.  */
  52.  
  53. CLIPPER GT_SToD()
  54. {
  55.         if (PCOUNT == 1 && ISCHAR(1))
  56.         {
  57.                 _retds(_parc(1));
  58.         }
  59.         else
  60.         {
  61.                 _retds(NULL);
  62.         }
  63. }
  64.