Spread DateTime Cell fraction of a second mask

Posted by: brian-gyetko on 8 September 2017, 1:37 pm EST

  • Posted 8 September 2017, 1:37 pm EST

    I have the following code assigning the formatting to a DateTime object on a bound query to the database.  The default behavior is to show the Date time as MM/dd/yyyy.  I am looking for millisecond resolution.  I am using Spread 4.0 for forms.  The docs indicate that the UserDefined format takes all the formatting of a .NET DateTimeFormatInfo object, which supports fff for fraction of a second.  When I run the code, my dates and times are formatted correctly except the fff is not converted.  It just shows "2009/11/14 00:00:00.fff".  Any ideas on what I am doing incorrectly?

    FarPoint.Win.Spread.CellType.DateTimeCellType dateTimeCellType
    = new FarPoint.Win.Spread.CellType.DateTimeCellType();

    dateTimeCellType.DateTimeFormat
    = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined;

    dateTimeCellType.UserDefinedFormat = "yyyy/MM/dd HH:mm:ss:fff";

    spdResults.ActiveSheet.Columns[3].CellType = dateTimeCellType;

    spdResults.ActiveSheet.Columns[3].Width = 130;

  • Replied 8 September 2017, 1:37 pm EST

    Hello,


    Milliseconds are currently not supported in our DateTimeCellType. They should work correctly in our GeneralCellType. It has been entered as a possible enhancement for a future version to support this format in the DateTimeCellType.

  • Replied 8 September 2017, 1:37 pm EST

    Thank you for the response.  That was my next approach. (GeneralCellType)
Need extra support?

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

Learn More

Forum Channels