Consider this code:
TimeStamp.Text = BlogComment.Date.UtcNow.ToString("yyyy-MM-ddTHH\:mm\:ss.fffffffzzz");
BlogComment.Date is a DateTime object with its date set. TimeStamp is just a literal.
I keep getting unrecognised escape sequence. How can I fix this problem?
You want a string literal – prefixing a string with @ will not parse the string for escape sequences like you have in your string but take it in “literal” form.
Edit:
Also there is no
UtNowproperty on DateTime – this is a static property only available on the DateTime class. You can just write:or if your intention was to convert the time to UTC: