We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

mm/dd/yyyy

3.0.1.0 When trying to apply a NumberFormat of "mm/dd/yyyy", I only get "m/d/yyyy" when viewing in Excel. Here''s the code: for ( int i = 0; i < reportData.Count; i++ ) { mySheet.Range[ currentRow, 1 ].Text = reportData[ i ][ "Portfolio" ].ToString(); if ( reportData[ i ][ "TradeDate" ] != DBNull.Value ) mySheet.Range[ currentRow, 2 ].DateTime = Convert.ToDateTime( reportData[ i ][ "TradeDate" ] ); mySheet.Range[ currentRow, 2 ].NumberFormat = "mm/dd/yyyy"; currentRow++; } Any issue with this in version 3.0.1.0? Thanks!

1 Reply

AD Administrator Syncfusion Team February 24, 2005 12:17 PM UTC

Hi Shannon, Could you please try using this number format mySheet.Range[ "j1" ].NumberFormat = "mm/dd/yyyy;@"; This is a format that MS Excel uses to represent mm/dd/yyyy format Please let me know if you have any questions. Thanks, Stephen. >3.0.1.0 > >When trying to apply a NumberFormat of "mm/dd/yyyy", I only get "m/d/yyyy" when viewing in Excel. > >Here''s the code: > > for ( int i = 0; i < reportData.Count; i++ ) > { > mySheet.Range[ currentRow, 1 ].Text = reportData[ i ][ "Portfolio" ].ToString(); > if ( reportData[ i ][ "TradeDate" ] != DBNull.Value ) > mySheet.Range[ currentRow, 2 ].DateTime = Convert.ToDateTime( reportData[ i ][ "TradeDate" ] ); > mySheet.Range[ currentRow, 2 ].NumberFormat = "mm/dd/yyyy"; > > currentRow++; > } > >Any issue with this in version 3.0.1.0? > >Thanks!

Loader.
Live Chat Icon For mobile
Up arrow icon