We have a requirement where the date-time should appear in MM/DD/YYYY HH:MM:SS (24 hr) format in the UltraWinGrid in a bound coulmn of data type DateTime.
eg. 05/21/2008 23:45:00
We have tried with the given formats and Styles.
Trying to modify some of the existing formats (tried with {LOC}mm/dd/yyyy hh:mm:ss and mm/dd/yyyy hh:mm:ss) gave some unexpected results, the entered time (23:45:00) got changed to 11:45:00 (AM/PM format but did not display "PM").
Thanks in advance.
Go into your column properties for that Date column and add/change this:
Format (property): MM/dd/yyyy HH:mm:ss
MaskInput (property): {LOC}mm/dd/yyyy hh:mm:ss
Thanks for the solution, but we faced a problem. The given solution works when we tab out or click any where else, but clicking on the cell again makes the time come in 12 hour format (without AM/PM). e.g. DateTime given: 05/21/2000 23:45:01 DateTime on tabout: 05/21/2000 23:45:01 DateTime on cell activation: 05/21/2000 11:45:01 DateTime on tabout again: 05/21/2000 23:45:01 This happens when the particular cell is activated again. On tabbing out, the cell displays time again in 24 hr format. Can you help us with this problem? Thanks in advance.
That must be an issue with the Mask.
The Format property applies to a cell when it is NOT in edit mode.
The MaskInput applies when the cell IS in edit mode. By specifying {LOC} for the mask, it means that the mask will pick up the current culture settings. So the current culture must be set up to use a 12-hour time, not 24. I'm not sure how you force a mask to use 24-hour time. You might want to check the documentation on the MaskInput property and see what the options are. But you probably don't want to use {LOC} in there if you want to force it to always use 24-hour time.
Hi Infragistics,
It works now. Thanks for supporting.
Hello,
This might be because the 'DataType' of your column is not 'DateTime'. Try setting the type to 'DateTime' and also please take a look at the following two properties:http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/HTML/Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~DataType.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/HTML/Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~Format.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/HTML/Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~MaskInput.html
Please do not hesitate to ask if something comes up.
Hi Mike,
I have a problem when UltraGrid NOT in Edit Mode, my date time display as a number.
Example: I have inputed 01/31/2012, but NOT in Edit Mode, it displayed 01312012.
What did I wrong? Please help, thanks.
Hi,
I managed to get this sorted by setting the MaskInput to '{date} {longtime}'
Hope this helps!
I also have this problem. Is the functionality to display consistently the date time format as 'MM/dd/yyyy HH:mm:ss' with or without focus not supported by Infragistics?