c# - Converting date time to string with separator "T" -
how convert date object "t" separate date , time
e.g., 2013/07/22t09:43:21
instead of 2013/07/22 09:43:21
use datetime.tostring
custom format string contains t
@ desired position.
var date = new datetime(2013, 07, 22, 09, 43, 21); var output = date.tostring("yyyy/mm/ddthh:mm:ss", cultureinfo.invariantculture);
note i've used cultureinfo.invariantculture
avoid /
gets replaced actual culture's date-separator.
demo 2013/07/22t09:43:21
Comments
Post a Comment