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

CURTIME$  PowerBASIC  Function

         

CURTIME$ function evaluates to current time string formatted according to specified pattern.

Direct dependency:

TRANS$ Translate character string symbols function



 CURTIME$  Source  Program                     Debugging program                   Debugging logout

      ' CURTIME$(1.0)  Form Current Time String                  10/10/1992-07/10/2010
      ' ------------------------------------------------------------------------------
      ' Copyright (C) 1992-2010 by Vladimir Veytsel                      www.davar.net

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

      '    Function

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

      '    CURTIME$ function returns formatted current time.

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

      '    Pattern$  - Time formatting pattern consisting of:
      '                HR  - Hour   of current day
      '                MI  - Minute of current hour
      '                SE  - Second of current minute
      '                    - Any delimiters different from HRMISE

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

      '    Current time string unpacked according specified pattern.

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

      '  - Empty (default) pattern is equivalent to "HR:MI".
      '  - It is of paramount importance that delimiters should be different
      '    from any of HRMISE characters.

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

      '    CURTIME$("")        ="12:34"
      '    CURTIME$("HR.MI")   ="12.34"
      '    CURTIME$("HRMISE")  ="123456"
      '    CURTIME$("HR:MI:SE")="12:34:56"
      '    CURTIME$("HR.MI.SE")="12.34.56"
      '    CURTIME$("HR-MI/SE")="12-34/56"

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

           #INCLUDE ONCE "TRANS"

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

           FUNCTION CURTIME$(Pattern$)

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

           IF (LEN(Pattern$)=0) THEN Pattern$="HR:MI"

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

           CURTIME$=TRANS$(Pattern$,"HR-MI-SE",TIME$)

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

           END FUNCTION
  
         

 CURTIME$  Debugging  Program                     Source program                   Debugging logout

      ' CURTIME$(1.0)  Form Current Time String                  10/10/1992-07/10/2010
      ' ------------------------------------------------------------------------------

        #INCLUDE "CURTIME"

        FUNCTION PBMAIN

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

        PRINT "CURTIME$(''        )='"; _
               CURTIME$(""        ); "'"
        PRINT "CURTIME$('HR.MI'   )='"; _
               CURTIME$("HR.MI"   ); "'"
        PRINT "CURTIME$('HRMISE'  )='"; _
               CURTIME$("HRMISE"  ); "'"
        PRINT "CURTIME$('HR:MI:SE')='"; _
               CURTIME$("HR:MI:SE"); "'"
        PRINT "CURTIME$('HR.MI.SE')='"; _
               CURTIME$("HR.MI.SE"); "'"
        PRINT "CURTIME$('HR-MI/SE')='"; _
               CURTIME$("HR-MI/SE"); "'"

        END FUNCTION
  
         

 CURTIME$  Debugging  Logout                   Source program                   Debugging program


   CURTIME$(1.0)  Form Current Time String  09-17-2016  14:25
   ----------------------------------------------------------

   CURTIME$(''        )='14:25'
   CURTIME$('HR.MI'   )='14.25'
   CURTIME$('HRMISE'  )='142555'
   CURTIME$('HR:MI:SE')='14:25:55'
   CURTIME$('HR.MI.SE')='14.25.55'
   CURTIME$('HR-MI/SE')='14:25/55'
        

         

View [and save] CURTIME.BAS text       View [and save] ZCURTIME.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