Hi,
I am wondering if anyone could give me a helping hand how to convert a UNIX timestamp into a readable Basic4PPC-date. For those wondering what this is, then take a look at this page:
Unix time - Wikipedia, the free encyclopedia
This is an example of UNIX timestamp:
1265976300. If you convert into a readable date-format it becomes:
Friday, February 12th 2010, 12:05:00 (GMT). You can find a handy converter online here:
4WebHelp - Online Tools: Unix Timestamp Converter
I didn't know about UNIX timestamps until I ran into it in a project of mine.
I searched the forum to see if anyone had already written a converter but couldn't find any information.
I found the below c#-function which turns a UNIX timestamp into a .NET System.DateTime object and it works well in a desktop VS-project:
[SIZE="1"]C#:
1: static DateTime ConvertTimestamp(double timestamp)
2: {
3: return new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(timestamp).ToLocalTime();
4: }[/SIZE]
Above code-snippet takes into consideration also localtime while normally the UNIX stamptime refers to UTC (GMT).
I tried to write my own in Basic4PPC but frankly I have some problems getting used to Ticks....
Thus, if anyone already has written some conversion-code, could you please share it since it could be useful for others too.
Many thanks in advance.