• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
        • AdjLBA Function
        • AdjLBI Function
        • AdjUBA Function
        • AdjUBI Function
        • DateAdd Function
        • DateDiff Function
        • DateValid Function
        • PublishDate Function
        • SetLB Function
        • SetUB Function
        • SysDate Function
        • SysTime Function
        • timestamp Function
        • timestring Function
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

SysDate Function

Format
i = sysdate(ʃdate_formatʃ,timestamp_valueʅʅ);
Description
The sysdate function returns the current system date as an integer. The optional string expression date_format is composed of a combination of DD (days), MM (months), and/or YY or YYYY (years). YY returns the current year in two digits, while YYYY returns it in four digits. The strings DD, MM and YY or YYYY can be put together in any order to make up a customized format. If no date format is specified, the function returns the date in the format YYMMDD.
Passing an optional numeric expression, timestamp_value, means that instead of using the system date, the function will use the date, in the local machine's time zone, of a date/time value that came from timestamp function.
The current date can be returned as a string using the edit function as follows:
edit("9999-99-99",sysdate("YYYYDDMM"));
Return Value
The function returns the system date as an integer. If the date format is invalid, the function returns 0.
Example
// if the current date is December 17, 1999...
x = sysdate("DDMMYYYY");    // returns 17121999
x = sysdate("MMYYYY");      // returns 121999
x = sysdate("DD");          // returns 17
x = sysdate();              // returns 991217

// if the current date is March 8, 2000...
x = sysdate("DDMMYYYY");    // returns 8032000
x = sysdate("MMYYYY");      // returns 32000
x = sysdate("MMYY");        // returns 300
x = sysdate("DD");          // returns 8
x = sysdate();              // returns 308
See also: DateAdd Function, DateDiff Function, DateValid Function, PublishDate Function, SysTime Function, timestamp Function