PDA

View Full Version : How do I convert milliseconds into a timestamp?



Serapy
09-19-2010, 03:32 AM
I took this piece from an unencrypted .DAT file:


00 e1 27 17 6f e6 69 c0

Which translates to 63,374,851,375,000,000 in decimal. This number is definitely microseconds.

And this huge number cannot bypass the 1st January 1970 00:00:00 format; such a format that most converters use today.

So, yes. Is there such a converter that uses the 1st January of the year 1 format? Or how shall I make one?

And by the way, a timestamp is both date and time.

EDIT- Sorry, it's microseconds, not milliseconds.

Thanks in advance!

Serapy
10-05-2010, 03:38 PM
finally fixed it...


private void generate(object sender, EventArgs e)
{
String dateString = yyyy.Text + dd.Text + MM.Text + hh.Text + Mi.Text + ss.Text;
DateTime timestamp;
if (!DateTime.TryParseExact(dateString, "yyyyddMMHHmmss", null,
DateTimeStyles.None, out timestamp ))
return;
long ticks = timestamp.Ticks;
long microseconds = ticks / 10;
convertedText.Text = microseconds.ToString("X");
}