My Technical Notes

Friday, 8 February 2013

Using DateTime.ToString to make string yyyyMMddHHmm


string str = DateTime.Now.ToString("yyyyMMddHHmm");

keywords: timestamp

EDIT: Add ss to the end if you want seconds too. And fff to the end if you want milliseconds.

No comments: