In case of development in clinet/server application, datetime formation conversion is frequently required.
Following is the simple example for DateTime Conversion.
private double ConvertToTimestamp(DateTime value)
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (double)span.TotalSeconds;
}
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (double)span.TotalSeconds;
}
Another posts included in "C#"
| Finding process name on OS (0) | 2008/09/22 |
| To load image from file (0) | 2009/09/03 |
| How to convert bitmap image to jpeg image ? (0) | 2009/09/03 |
| Retrieve system information (0) | 2008/09/22 |
| How to rename(change file name) in C# ? (1) | 2008/03/12 |
| Find Files in certain directory (0) | 2008/02/25 |
| How to speed up access to the RichTextBox Lines property (0) | 2007/09/25 |
| How to detect resource leaks in a Form (0) | 2007/09/25 |

Prev

Rss Feed