Код: Выделить всё
private static string strTimeStampMsg(string strMsg, DateTime? dtTimestamp = null) {
if (strMsg == null || strMsg.Length == 0) {
return string.Empty;
}
string strDateTime;
if (dtTimestamp != null) {
strDateTime = dtTimestamp.ToString(CSTR.dtFormat);
} else {
strDateTime = DateTime.Now.ToString(CSTR.dtFormat);
}
return strDateTime + "> " + strMsg;
}
Код: Выделить всё
public const string dtFormat = "dd-MM-yyyy HH:mm:ss.fff";
Код: Выделить всё
strDateTime = dtTimestamp.ToString(CSTR.dtFormat);
Подробнее здесь: https://stackoverflow.com/questions/791 ... e-datetime
Мобильная версия