Closed GoogleCodeExporter closed 9 years ago
Hi,
Do you know if other databases support this or a similar function?
Regards,
Thomas
Original comment by thomas.t...@gmail.com
on 25 Jun 2010 at 4:19
in Postgrssql there is: EXTRACT('epoch' FROM ...)
Oracle does not have unixtime but this:
http://www.techonthenet.com/oracle/functions/to_timestamp.php
not in M$Sql but this:
http://www.bigresource.com/MS_SQL-UNIX-Time-Conversion-Functions-8h91OTq4.html
Sybase is similar to M$Sql.
I've not looked upon the source yet but would you accept patches for additional
functions ?
Original comment by teref...@gmail.com
on 1 Jul 2010 at 10:36
Hi,
This also works:
call datediff(second, '1970-01-01', now());
It returns the same value as:
CREATE ALIAS UNIX_TIMESTAMP AS $$ long unix_timestamp() { return
System.currentTimeMillis()/1000L; } $$;
call UNIX_TIMESTAMP();
> would you accept patches for additional functions ?
Yes, please. You can submit them in the same form as above (as a SQL
statement). I would like to not add such compatibility features as 'built-in'
functions (like CAST). Instead, I would like to keep 'compatibility' functions
separate from the main database. My idea is to keep such functions / features
in a separate 'module' so that the main database engine stays small. However,
so far, there is no such module system. For example, the UNIX_TIMESTAMP is
already included within H2, but in a separate file:
http://code.google.com/p/h2database/source/browse/trunk/h2/src/tools/org/h2/mode
/FunctionsMySQL.java
If you want, you can submit patches for this file, or for other such files
(FunctionPostgreSQL.java and so on).
I really need to work on modularization, so those functions are automatically
included when switching the mode (MODE=MYSQL in your case). I will add a
feature request. I think that has relatively high priority.
Original comment by thomas.t...@gmail.com
on 2 Jul 2010 at 3:12
This issue is in the roadmap at http://www.h2database.com/html/roadmap.html -
priority is tracked there.
Original comment by thomas.t...@gmail.com
on 28 Jan 2011 at 7:37
Original issue reported on code.google.com by
teref...@gmail.com
on 24 Jun 2010 at 12:47