Home Forums WinForms controls Xceed Grid for WinForms Data / Time question problem

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13445 |

    I have an Access Data Base which have a “Date/Time” type field. The problem is, whatever format I put in this field (short date, long data/time, only date, only time) Xceed grid will always displays me the following format…

    “dd-mm-yy hh:mm:ss”

    I how can I format date and time in Xceed Grid?

    Please use some code to explain this (if possible)

    I will really appreciate your help on this one…

    Thanks

    Imported from legacy forums. Posted by EFileTahi-A (had 1178 views)

    User (Old forums)
    Member
    Post count: 23064

    In what format do you want it to be?

    Imported from legacy forums. Posted by Tommy (had 232 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Tommy,

    For date I will need the “dd-mm-yyyy” format, as for time, I need hh:mm:ss (24 hour clock)…

    Hope to hear from you soon…

    Imported from legacy forums. Posted by EFileTahi-A (had 322 views)

    User (Old forums)
    Member
    Post count: 23064

    You have to set the <b>FormatProvider</b> and <b>FormatSpecifier</b> properties of the column, like this:<code>grid.Columns[“dt”].FormatProvider = CultureInfo.CurrentCulture.DateTimeFormat;
    grid.Columns[“dt”].FormatSpecifier = “format string”;</code>
    The format string defines how the date & time is formatted:
    – date: “dd-MM-yyyy” (month = uppercase M)
    – time: “HH:mm:ss” (hour: uppercase H = 24 hour clock)
    – both: “dd-MM-yyyy HH:mm:ss”

    Imported from legacy forums. Posted by Tommy (had 469 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you Tommy!

    Imported from legacy forums. Posted by EFileTahi-A (had 3535 views)

    User (Old forums)
    Member
    Post count: 23064

    Are the “FormatProvider” and “FormatSpecifier” properties obsolete ? I can not find those properties in the Column class.

    How can I still setting the Format to the current user CultureInfo ?

     

    Imported from legacy forums. Posted by Harold (had 640 views)

    Xceed Support
    Member
    Post count: 5658

    No, these properties are not obsolete. You should be able to set those properties.

    What exactly is the DataType of your column? Our DateEditor only supports the DateTime type, not the SQLDateTime. If your DataType is SQLDateTime, you will need to use your own Editor, our convert the data to DateTime type.

    Imported from legacy forums. Posted by CharlesB (had 1200 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.