xxxxxxxxxx
public static String GetTimestamp(DateTime value)
{
return value.ToString("yyyyMMddHHmmssffff");
}
// ...later on in the code
String timeStamp = GetTimestamp(new DateTime());
Console.WriteLine(timeStamp);
xxxxxxxxxx
string timestamp = DateTimeOffset.UtcNow.DateTime.ToLocalTime().ToString("yyyy-MM-dd HHmmss");