acumatica Creating Date and Time Fields in Acumatica The PXDBTimeSpan Attribute


The PXDBTimeSpan attribute is designed to work with a DAC field of the Nullable<int> (int?) type and store time value inside a DAC field as the number of minutes passed since midnight:

#region UsrTimeInt
public abstract class usrTimeInt : IBqlField
{ }

[PXDBTimeSpan(DisplayMask = "t", InputMask = "t")]
[PXUIField(DisplayName = "Time Value")]
public int? UsrTimeInt { get; set; }

In the UI, for a field decorated with PXDBTimeSpanAttribute the system creates a drop-down with half hour interval values both on a form:

enter image description here

and within a grid cell:

<px:PXDateTimeEdit runat="server" ID="edUsrTimeInt" DataField="UsrTimeInt" TimeMode="true" />

enter image description here

<px:PXGridColumn DataField="UsrTimeInt" Width="90px" TimeMode="true" />