Snippet
/// <summary>
/// method for converting a UNIX timestamp to a regular
/// System.DateTime value (and also to the current local time)
/// </summary>
/// <param name="timestamp">value to be converted</param>
/// <returns>converted DateTime in string format</returns>
private DateTime ConvertTimestamp(double timestamp)
{
//create a new DateTime value based on the Unix Epoch
DateTime converted = new DateTime (1970, 1, 1, 0, 0, 0, 0);
//add the timestamp to the value
converted.AddSeconds(timestamp);
//return the value in string format
return converted.ToLocalTime();
}
Copy & Paste
|