Skip to content

DateTimeToString - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

String

Arguments

Argument Description
dtIn Datetime value to be formatted as string.

Description

This function can be used to format a DateTime variable as a string in the YYYY-MM-DD HH:MM:SS format, which is often used by SQL servers.

Starting with version 5.0.1, the function is redirected to a child object based on the cDRReportHelper class.

DataFlex Framework usage

  • Web
  • Windows
  • FlexTron

Sample

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'

    Procedure Set BeginningDateParam String sReportId String sValue
        Integer iParameter

        If (sReportId <> '' and sValue <> '') Begin
            Get DateTimeToString sValue to sValue
            Get ParameterIdByName sReportId "Beginning_Date" to iParameter
            If (iParameter <> -1) Begin
                Set psParameterValue sReportId iParameter to sValue
            End
        End
    End_Procedure
End_Object

Object oRunReportButton is a Button
    Set Label to 'Run Report'

    Procedure OnClick
        String sReportId sFromBeginningDate

        Get OpenReport of oReport to sReportId
        If (sReportId <> '') Begin
            Get Value of oBeginningDate to sFromBeginningDate
            Set BeginningDateParam of oReport sReportId to sFromBeginningDate
            Send DisplayReport of oReport
        End
    End_Procedure
End_Object