acumatica Creating Date and Time Fields in Acumatica The PX(DB)DateAndTime Attribute


The PXDBDateAndTime attribute and the PXDateAndTime attribute are designed to work with a DAC field of the Nullable<DateTime> (DateTime?) type and store both date and time value parts inside a single field:

#region UsrDateAndTime
public abstract class usrDateAndTimeAttribute : IBqlField
{ }

    DisplayNameDate = "Date Value Part",
    DisplayNameTime = "Time Value Part")]
public DateTime? UsrDateAndTime { get; set; }

From the UI perspective, for a field decorated with PXDBDateAndTimeAttribute or PXDateAndTimeAttribute, one is expected to create either separate input controls for date and time value parts:

enter image description here

<px:PXDateTimeEdit runat="server" ID="edUsrDate" DataField="UsrDateAndTime_Date" />
<px:PXDateTimeEdit runat="server" ID="edUsrTime" DataField="UsrDateAndTime_Time" TimeMode="True" />

or separate grid columns to enter and display date and time values:

enter image description here

    <px:PXGridColumn DataField="UsrDateAndTime_Date" Width="90px" />
    <px:PXGridColumn DataField="UsrDateAndTime_Time" Width="90px" TimeMode="True" />