[Gambas-user] Re; MySQL "timestamp"

Rolf Schmidt rolf.frogs at ...221...
Wed Jul 18 09:21:37 CEST 2007


Hi Paul Horechuk,

> Pardon me for jumping in here, but aren't timestamps supposed to be
> returned as longint? They should like something like 1184670240 = Jul 17,
> 2007 @ 11:04:00. Whenever I worked with timestamps, I had to write a class
> to convert either way.

Be careful, databases should be able to handle date and time outsite of the 
UNIX-timestamp period - i.e. before 1.1.1970 and x.x.2035(?). So the internal 
representation is typically not the well known UNIX-timestamp. Therefor the 
database usually expects correctly formed date and time values for a 
timestamp entry and give back a date/time pair as the result of a query.

> I understand mysql can convert as a sql command. I found this on the web:
> http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
> which has a number of functions dealing with conversions.

Also PostgrSQL have such functions, which should be used to extract (which is 
the name of the function) parts of a timestamp - for example the year or the 
month...

Fine regards
Rolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20070718/b3458bcb/attachment.sig>


More information about the User mailing list