c# - what is the format of this timestamp - "1369158405"? -


what timestamp format - "1369158405"?

this link http://www.timestampgenerator.com/ provides such formats not find information on format name.

i curious know how such timestamp calculated generate format of type "1369158405" "tue may 21 17:46:45 2013 gmt"? there function creates such time stamps in c#?

that's unix timestamp: number of seconds have elapsed since midnight coordinated universal time (utc), 1 january 1970

there no built-in function in c# create unix timestamp. should trick:

public static double converttounixtimestamp(datetime value) {     var span = (value - new datetime(1970, 1, 1, 0, 0, 0, 0).tolocaltime());     return span.totalseconds; } 

if want truncate milliseconds, cast result long:

var timestamp = (long)converttounixtimestamp(datetime.now) 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -