[Gambas-user] How to convert unix timestamp into gambas date and time
Rolf-Werner Eilert
eilert-sprachen at ...221...
Fri Feb 3 11:08:33 CET 2012
Am 03.02.2012 10:32, schrieb Rolf Schmidt:
> Hi "another Rolf"
>
>>> is there a function which allows to convert an unix timestamp into the
>>> appropriated date/time in Gambas3?
>>>
>>> If, how is it called and how to use.
>
>> Take a look at this one:
>> http://gambasdoc.org/help/lang/stat?v3
>> file.stat should deliver a file date. Or did I get you wrong?
>
> For my problem, you get wrong. The unix timestamp is not only the time
> of a file. It is the time in seconds since the 1. Jan. 1970. Even the
> system clock only counts the seconds.
>
> My problem is, that a network application send a timestamp as a string.
> I have to convert this string into Date and Time - which is usually done
> in C or PHP or... by a function of a system library (which of course
> know leap years).
>
> And some times I would like to generate a timestamp as well, for example
> to send it to a database.
>
> Another helper out there?
>
> Rolf
>
May I nevertheless? :-)
Ok, I tried around a bit, take a look:
PUBLIC SUB Button1_Click()
DIM t$ AS String
t$ = CStr(CFloat(Now))
Message.Info(t$)
t$ = CDate(CFloat(t$))
Message.Info(t$)
END
Does it help?
Rolf
More information about the User
mailing list