Friday, September 2, 2011

Create a timestamp in c# (using Datetime)

Hi wondering how to create a timestamp in c# using Datetime values, use the method below. 
public static String GetTimestamp(this DateTime value)
    return value.ToString("yyyyMMddHHmmssffff");


Anonymous said...

//Get UTC time in Hours,minutes,seconds,milliseconds(fractions) format
string utcTime = DateTime.UtcNow.ToString("HHmmss.ffff");

//Get UTC date in date,month,year format
string utcDate = DateTime.UtcNow.Date.ToString("ddMMyy");

Post a Comment


2011 ·Code-Studio by yrus.