c# get current timestamp code example
Example 1: c# get time
var timeString = DateTime.Now.ToString("hh:mm:ss");
var time24 = DateTime.Now.ToString("HH:mm:ss");
var timeString = DateTime.Now.ToString("t");
var shortTimeStr = DateTime.Now.ToShortTimeString();
var longTimeStr = DateTime.Now.ToLongTimeString();
var longtimestr = DateTime.Now.ToString("T");
var timeSpan = DateTime.Now.TimeOfDay;
Example 2: c# datetime now timestamp
String timeStamp = GetTimestamp(DateTime.Now);
Example 3: c# datetime now timestamp
var Timestamp = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();