Christine
Christine

Reputation: 640

How can I format a date field?

I have a DateTime field that contains the MM/DD/YYYY HH:MM:SS date/time in the database, but when I apply it to a PXGrid, it only displays the date. How can I make it display the date AND TIME? I'm overriding the DAC object with the following attributes:

[PXUIField(DisplayName = "Start Time", Visibility = PXUIVisibility.SelectorVisible)]
[PXDBDateAndTime()]
[PXDefault]
protected virtual void FSAppointment_ScheduledDateTimeBegin_CacheAttached(PXCache Sender) { }

Upvotes: 1

Views: 1370

Answers (2)

Patrick Chen
Patrick Chen

Reputation: 1066

A year later, I stumbled onto this because I had the same question. Here's what worked for me.

[PXDBDate(DisplayMask="f",PreserveTime=true,InputMask="f")]

Upvotes: 0

Ken
Ken

Reputation: 116

Try to add attribute [PXDBDate(PreserveTime = true)] instead of [PXDBDateAndTime()]

Upvotes: 2

Related Questions