Snipplet code to convert current date time to epoch time
you may go to http://www.epochconverter.com/ to check the result.
public long GetEpochTime()
{
DateTime dtCurTime = DateTime.Now;
DateTime dtEpochStartTime = Convert.ToDateTime("1/1/1970 00:00:00 AM");
TimeSpan ts = dtCurTime.Subtract(dtEpochStartTime);
long epochtime;
epochtime = ((((((ts.Days * 24) + ts.Hours) * 60) + ts.Minutes) * 60) + ts.Seconds);
return epochtime;
}
Incoming search terms:
- diary in c#
- c# converttodatetime epoch
- Convert ToDateTime() long
- EpochTime C#
- getepochtime c#
No comments yet.