' 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
