time format in 24 hours

Posted by: lhanicotte on 8 September 2017, 2:28 pm EST

  • Posted 8 September 2017, 2:28 pm EST

    I have in my spread some datetime cell. One of the cells is initialise to the value "15:00" but the cell show only "03:00". How can i do to show "15:00" in my cell?
  • Replied 8 September 2017, 2:28 pm EST

    The Celltype is probably using your system settings I tested this and it works to display 24 hour time.

    <FONT size=2 face=Consolas><FONT size=2 face=Consolas>

    FarPoint.Win.Spread.CellType.</FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>DateTimeCellType</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> dtct = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>new</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> FarPoint.Win.Spread.CellType.</FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>DateTimeCellType</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>();


    dtct.DateTimeFormat = FarPoint.Win.Spread.CellType.</FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>DateTimeFormat</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>.UserDefined;


    dtct.UserDefinedFormat = </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"MM/DD/YY HH:mm:ss"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;


    fpSpread1.ActiveSheet.Cells[0, 0].CellType = dtct;


    fpSpread1.ActiveSheet.Cells[0, 0].Value = System.</FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>DateTime</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>.Now;

    </FONT></FONT>
  • Replied 8 September 2017, 2:28 pm EST

    Thanks, it's working
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels