Reg: setting a mask for datetime cell

Posted by: subba on 8 September 2017, 1:58 pm EST

  • Posted 8 September 2017, 1:58 pm EST

    hi,


    i want to know how i can set mask for a datetime cell to just show up time part.


    i also want know from where i can get the API to browse through.


     


    Thanks


    subba


     

  • Replied 8 September 2017, 1:58 pm EST

    Hello Subba,


    In order to show only Time in a cell you can use DateTimeCellType and set the DateTimeFormat to UserDefined.Now set the Format as you want, Below is the code snippet that does the same,

    <FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> dt </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT size=2> FarPoint.Win.Spread.CellType.DateTimeCellType()</FONT>


    <FONT size=2>dt.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined


    dt.UserDefinedFormat = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"hh:mm"</FONT></FONT>


    <FONT size=2>FpSpread1.ActiveSheet.Cells(0, 0).CellType = dt


    FpSpread1.ActiveSheet.Cells(0, 0).Value = DateTime.Now.TimeOfDay


     


     


    Hope it will help you.


    Thanks & Regards,

    </FONT>

     

Need extra support?

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

Learn More

Forum Channels