Output the server date, time and time zone info in C#.
void Main()
{
//
// Shows the current server's datetime and timezone info.
//
var now = DateTime.Now;
var tz = TimeZone.CurrentTimeZone;
string serverDate = string.Format(CultureInfo.InvariantCulture,
"Server date is {0}.", @now.ToString("D", CultureInfo.InvariantCulture));
string serverTime = string.Format(CultureInfo.InvariantCulture,
"Server time is {0}.", @now.ToString("T", CultureInfo.InvariantCulture));
string timeZone = string.Format(CultureInfo.InvariantCulture,
"All dates and times displayed are in the {0} zone.",
(tz.IsDaylightSavingTime(now) ? tz.DaylightName : tz.StandardName));
Console.WriteLine(serverDate);
Console.WriteLine(serverTime);
Console.WriteLine(timeZone);
// Example output:
// -> Server date is Wednesday, 07 October 2015.
// -> Server time is 11:03:32.
// -> All dates and times displayed are in the Central Daylight Time zone.
}