Crystal Reports for Eclipse Designer Guide

CDateTime

The DateTimeValue and DateTime functions are equivalent to CDateTime.
Description
The CDateTime function converts Numbers, Strings, Dates, YYYY, MM, DD, and HH, MM, SS values to DateTime values.
Overloads
  • CDateTime (string)
  • CDateTime (number)
  • CDateTime (date)
  • CDateTime (date, time)
  • CDateTime (YYYY, MM, DD)
  • CDateTime (YYYY, MM, DD, HH, MM, SS)
  • Arguments
  • string represents a date and time. For example, "September 15, 1999 10:45am"
  • number represents a number of days from December 30, 1899. For example, 20 represents 20 days from December 30, 1899, which is January 19, 1900.
    Number can be positive, negative or fractional.
  • date is a Date value.
  • time is a Time 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).
  • HH is a whole number representing an hour of the day; MM is a whole number representing a minute; SS is a whole number representing a second.
  • Returns
    A DateTime value.
    Action
    CDateTime (string) converts the given string to a DateTime value.
    CDateTime (number) converts the given number to a DateTime value, where number holds the number of days since Dec. 30, 1899.
    CDateTime (date) uses the given date to create the date portion, assigns 12:00:00 AM for the time portion for the returned DateTime value.
    CDateTime (date, time) uses the given Date and Time data types to create a combined DateTime value.
    CDateTime (YYYY, MM, DD) uses the given arguments to create the date portion, and assigns 12:00:00 AM for the time portion for the returned DateTime value.
    CDateTime (YYYY, MM, DD, HH, MM, SS) uses the given arguments to create a combined DateTime value.
    Examples
    CDateTime ("10/4/1999 10:20am")
    Returns the DateTime value October 4, 1999 10:20:00 am
    CDateTime (12.5)
    Returns the DateTime value January 11, 1900 12:00:00 pm
    CDateTime (-2.5)
    Returns the DateTime value December 27, 1899 12:00:00 pm
    CDateTime (CDate ("Dec. 25, 1999"))
    Returns the DateTime value December 25, 1999 12:00:00 am
    CDateTime (CDate ("November 10, 1999"), CTime("12:20am"))
    Returns the DateTime value November 10, 1999 12:20:00 am
    CDateTime (1945, 8, 21, 0, 0, 0)
    Returns the DateTime value August 21, 1945 12:00:00 am
    CDateTime (1945, 8, 21, 10, 0, 0)
    Returns the DateTime value August 21, 1945 10:00:00 am
    Comments
    You can use the IsDateTime function to check if a String argument can be converted to a DateTime before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.
    See Also



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