db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kirru23 <kiran.nellima...@gmail.com>
Subject Unix_timestamp value and date formatting issue
Date Wed, 02 Jun 2010 03:20:37 GMT

I am working on converting mysql to derby database. I am having some
problems:
in mysql the result of the query:
mysql> select unix_timestamp(current_timestamp);
+-----------------------------------+
| unix_timestamp(current_timestamp) |
+-----------------------------------+
|                        1275441961 |
+-----------------------------------+
in derby :
ij> select {fn   TIMESTAMPDIFF(
SQL_TSI_second,timestamp('1970-01-01-00.00.00'),current timestamp)}from
sysibm.sysdummy1;
1                  
--------------------
1275423991

Hence the difference is around 17970 seconds.
Does anyone implement any other formula for getting a more accurate value.
I am new to derby, so pls suggest how do i consider/check the timezone . Is
this difference due to timeze? if yes then how can I change me query to
consider that.

Another isue is date formatting.
I wanted to format it like the year part as yy instead of yyyy, fetchin the
date as 'd' instead of 'dd' etc. If there is no way of formatting by any
functions then moslty i wil try to manipulate it using code. Also, since i
am using PHP code i mite not be able to use the java functions. I heard
there is a function format_timestamp() in derby for formatting but it doesnt
work. let me know if anyone tried that out.

If anyone got a solution for above isues, pls suggest

-- 
View this message in context: http://old.nabble.com/Unix_timestamp-value-and-date-formatting-issue-tp28749721p28749721.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message