Skip to main content
Answer

How to enter Hours/Minutes for Custom field of type DateTime?

  • December 4, 2023
  • 4 replies
  • 292 views

nhatnghetinh
Captain II
Forum|alt.badge.img+11

Dear Team,

I want to create a new Custom field of type DateTime that can input Date and Hours/Minutes.

 

 

Please help me the solution !

 

Best Regards,

NNT

Best answer by aaghaei

If you are using form then have a loot at the below

 

<px:PXTimeSpan DataField="Time" runat="server" ID="edtime" SummaryMode="true" InputMask="hh:mm" Width="100" ></px:PXTimeSpan>

 

If you are using grid then add from the data fields and it should come something like 

 

<px:PXGridColumn DataField="Date_Time" CommitChanges="true" ></px:PXGridColumn>

4 replies

aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • December 4, 2023

public abstract class date : PX.Data.BQL.BqlDateTime.Field<date> { }[PXDBDateAndTime(DisplayNameDate = "Date", DisplayNameTime = "Time", UseTimeZone = true)]
[PXUIField(DisplayName = "Date")]

public virtual DateTime? Date { get; set; }


nhatnghetinh
Captain II
Forum|alt.badge.img+11
  • Author
  • Captain II
  • December 4, 2023

Hi @aaghaei,

I have performed customization as you instructed but the results only display the Date. Cannot enter Time.

 

Best Regards,

NNT


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • Answer
  • December 4, 2023

If you are using form then have a loot at the below

 

<px:PXTimeSpan DataField="Time" runat="server" ID="edtime" SummaryMode="true" InputMask="hh:mm" Width="100" ></px:PXTimeSpan>

 

If you are using grid then add from the data fields and it should come something like 

 

<px:PXGridColumn DataField="Date_Time" CommitChanges="true" ></px:PXGridColumn>


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • December 4, 2023

A friendly advise. I underestand people like to be productive and get the things done but always is a good idea to read through the materials or watch the videos to learn doing the work the right way. I bet you would get answer for all your questions in the materials.