formatting - Convert milliseconds to individual format in C# NPOI -


i use npoi .net third party library export datas *.xlsx file. have got time value represented in milliseconds. example, 2 minutes 12 seconds 3 milliseconds represented 132003 milliseconds. display "132003" "02m 12.003s" in excel. if click cell in excel contains value, see "02m 12.003s" in cell, , "132003" in formula editor.

how can solve it?

thanks in advance.

enter image description here

consider code below:

var t = timespan.frommilliseconds(521516); var formatted = string.format("{0:d2}m:{1:d2}s:{2:d3}ms", t.minutes, t.seconds, t.milliseconds); system.diagnostic.debug.writeline(formatted); 

this output:

08m:41s:516ms

you can use code retrive formatted text , add excel.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -