Go to:  Davar site entry | Site contents | Site index | Personal Computer | PowerBASIC | Text bottom

CURDATE$  PowerBASIC  Function

         

CURDATE$ function evaluates to current date string formatted according to specified pattern.

Direct dependency:

TRANS$ Translate character string symbols function



 CURDATE$  Source  Program                     Debugging program                   Debugging logout

      ' CURDATE$(1.0)  Form Current Date String                  07/03/1990-07/11/2010
      ' ------------------------------------------------------------------------------
      ' Copyright (C) 1990-2010 by Vladimir Veytsel                      www.davar.net


      ' Type -------------------------------------------------------------------------

      '    Function

      ' Description ------------------------------------------------------------------

      '    CURDATE$ function returns formatted current date.

      ' Parameter --------------------------------------------------------------------

      '    Pattern$  - Date formatting pattern consisting of:
      '                DA  - Day   of current month
      '                MO  - Month of current year
      '                YE  - Year  of current century
      '                CN  - Current century
      '                    - Any delimiters different from DAMOYECN

      ' Value ------------------------------------------------------------------------

      '    Current date string formatted according to specified pattern.

      ' Notes ------------------------------------------------------------------------

      '  - Empty (default) pattern is equivalent to "MO/DA/CNYE".
      '  - It is of paramount importance that delimiters should be different
      '    from any of DAMOYECN characters.

      ' Examples ---------------------------------------------------------------------

      '    CURDATE$(""          )="07/11/2010"
      '    CURDATE$("MO-DA-YE"  )="07-22-87"
      '    CURDATE$("MO/DA/CNYE")="08/28/1988"
      '    CURDATE$("CNYEMODA"  )="19870722"
      '    CURDATE$("CNYE-MO-DA")="1987-07-22"
      '    CURDATE$("MO-DA-YE"  )="07-22-87"
      '    CURDATE$("DA.MO.CNYE")="22.07.1987"

      ' External Function ------------------------------------------------------------

           #INCLUDE ONCE "TRANS"

      ' Start Function ---------------------------------------------------------------

           FUNCTION CURDATE$(Pattern$)

      ' Form Pattern Default Value ---------------------------------------------------

           IF (LEN(Pattern$)=0) THEN Pattern$="MO/DA/CNYE"

      ' Form and Return Function Value to the Point of Invocation --------------------

           CURDATE$=TRANS$(Pattern$,"MO-DA-CNYE",DATE$)

      ' Finish Function --------------------------------------------------------------

           END FUNCTION
  
         

 CURDATE$  Debugging  Program                     Source program                   Debugging logout

      ' CURDATE$(1.0)  Form Current Date String                  07/03/1990-07/11/2010
      ' ------------------------------------------------------------------------------

        #INCLUDE "CURDATE"

        FUNCTION PBMAIN

        PRINT "CURDATE$(1.0)  Form Current Date String  "; DATE$;
        PRINT "  "; LEFT$(TIME$, 5)
        PRINT STRING$(58,"-")
        PRINT

        PRINT "CURDATE$(''          )='"; _
               CURDATE$(""          ); "'"
        PRINT "CURDATE$('MO-DA-YE'  )='"; _
               CURDATE$("MO-DA-YE"  ); "'"
        PRINT "CURDATE$('MO/DA/CNYE')='"; _
               CURDATE$("MO/DA/CNYE"); "'"
        PRINT "CURDATE$('CNYEMODA'  )='"; _
               CURDATE$("CNYEMODA"  ); "'"
        PRINT "CURDATE$('CNYE-MO-DA')='"; _
               CURDATE$("CNYE-MO-DA"); "'"
        PRINT "CURDATE$('MO-DA-YE'  )='"; _
               CURDATE$("MO-DA-YE"  ); "'"
        PRINT "CURDATE$('DA.MO.CNYE')='"; _
               CURDATE$("DA.MO.CNYE"); "'"

        END FUNCTION
   
         

 CURDATE$  Debugging  Logout                   Source program                   Debugging program


   CURDATE$(1.0)  Form Current Date String  09-17-2016  12:26
   ----------------------------------------------------------

   CURDATE$(''          )='09/17/2016'
   CURDATE$('MO-DA-YE'  )='09-17-16'
   CURDATE$('MO/DA/CNYE')='09/17/2016'
   CURDATE$('CNYEMODA'  )='20160917'
   CURDATE$('CNYE-MO-DA')='2016-09-17'
   CURDATE$('MO-DA-YE'  )='09-17-16'
   CURDATE$('DA.MO.CNYE')='17.09.2016'
        

         

View [and save] CURDATE.BAS text       View [and save] ZCURDATE.BAS text
(Use [Back] button or [Alt]+[CL] to return here from the viewed text)
Copyright © 19882010 by
Go to:  Davar site entry | Site contents | Site index | Personal Computer | PowerBASIC | Text top