Crystal Reports for Eclipse Designer Guide

CDate

The DateValue and Date functions are equivalent to CDate.
Description
The CDate function converts Numbers, Strings, DateTime, and YYYY, MM, DD values to date values.
Overloads
  • CDate (number)
  • CDate (string)
  • CDate (dateTime)
  • CDate (YYYY, MM, DD)
  • Arguments
  • Number is a value representing the number of days starting from December 30, 1899. It can be positive or negative, and is truncated if fractional.
  • string is a text string representing a date, example: "September 20, 1999"; many formats are supported for the string
  • dateTime is a DateTime value.
  • YYYY is a whole number representing a year (for example, 1996); MM is a whole number representing a month (for example, 12 for December); DD is a whole number representing a day of the month (for example, 05).
  • Returns
    Date value
    Action
    CDate (number) converts and returns a Date given a number which is the number of days starting from December 30, 1899.
    CDate (string) converts and returns a Date given a string.
    CDate (dateTime) converts and returns a Date given a DateTime value.
    CDate (YYYY, MM, DD) uses the given arguments to create a Date value.
    Examples
    CDate ("Dec. 31, 1999")
    Returns the Date value for Dec. 31, 1999.
    CDate (50)
    Returns the Date value for February 18, 1900.
    CDate (#Oct. 20, 1999 12:02pm#)
    Returns the Date value for October 20, 1999.
    CDate (1930, 7, 30)
    Returns the Date value for July 30, 1930.
    Comments
    You can use the IsDate function to check if a String argument can be converted to a Date before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.



    SAP BusinessObjects
    http://www.sap.com/sapbusinessobjects/
    Support services
    http://service.sap.com/bosap-support/
    Product Documentation on the Web
    http://help.sap.com/