EpiTimeEditor datatype issues

I am sure that the more experienced technical members here might have a bit of a smile at this one…

So for posterity…The EpiTimeEditor accepts a number as the value not a date time. In E9 time is stored in a number field as second from midnight. so I guess this is its origin… In order to get around this awkward circumstance I replaced the EpiTimeEditor with an EpiDateTimeEditor and use the following code in the form load to make the EpiDateTimeEditor look like the EpiTimeEditor.

		dtStartTime.DropDownButtonDisplayStyle = ButtonDisplayStyle.Never;
		dtStartTime.SpinButtonDisplayStyle = ButtonDisplayStyle.Always;
		dtStartTime.MaskInput = "hh:mm";

This allowed me use a DateTime field which was added as I notice that in the schema of the database for the UD table all the existing date fields were only a Date datatype.

So an absolutely HUGE Shout out to Hidayat from the CSG team in Malaysia who pointed me in the right direction.

I guess I won’t be using the EpiTimeEditor any time soon.

5 Likes

Here I am digging up old posts again…

The implementation of EpiTimeEditor is baffling me since it’s working in the time and expense screen how I expect it should. i.e. bind to a decimal value and it is hours.fractionofhour.
When adding the custom control, no matter the binding, the value used is always seconds past midnight EXCEPT for 00:00, which is storing a value of 24.
I guess I’ll have to try the EpiDateTimeEditor, but it really seems like I shouldn’t have to. Is there possibly a hidden parameter to make EpiTimeEditor behave like in the time and expense form?

I take back the bit about the 00:00 being stored as 24…unsurprisingly, I had not removed one of my tests and it was setting the 24. Still, there must be some way to make the control behave as per the time editor.

1 Like

For those following along, it turns out very simple. Add the following to the InitializeCustomCode():
YourControl.EpiDecimal = true;

Another useful one, so that 12am doesn’t disappear, is:
YourControl.EpiTreatZeroAsNull= false;

4 Likes

Saved my bacon today @Hally . :beers: