acumatica Creating Date and Time Fields in Acumatica The PXDBTime Attribute


Example

The PXDBTime attribute is designed to work with a DAC field of the Nullable<DateTime> (DateTime?) type and store only the time part without date inside a DAC field:

#region UsrTime
public abstract class usrTime : IBqlField
{ }

[PXDBTime(DisplayMask = "t", InputMask = "t")]
[PXUIField(DisplayName = "Time Only Value")]
public DateTime? UsrTime { get; set; }
#endregion

In the UI, for a field decorated with PXDBTimeAttribute the system creates an input control accepting only time values both on a form:

enter image description here

<px:PXDateTimeEdit runat="server" ID="edUsrTime" DataField="UsrTime" TimeMode="True" />

and within a grid cell:

enter image description here

<Columns>
    ...
    <px:PXGridColumn DataField="UsrTime" Width="120px" TimeMode="True" />
    ...
</Columns>