[MonetDB-users] How to convert time from seconds to Year Month Day...
Thanks to people out there for providing excellent answers. I have time values in the form of seconds since 1970/01/01 00:00:00.000 GMT e.g. "1087488000". How could I convert them into Year, Month, Day, Hour, Minute, and Second. Iftikhar -- View this message in context: http://www.nabble.com/How-to-convert-time-from-seconds-to-Year-Month-Day...-... Sent from the monetdb-users mailing list archive at Nabble.com.
On Sun, Feb 10, 2008 at 04:00:41PM -0800, Iftikharn wrote:
Thanks to people out there for providing excellent answers.
I have time values in the form of seconds since 1970/01/01 00:00:00.000 GMT e.g. "1087488000".
ie you have timestamps?
How could I convert them into Year, Month, Day, Hour, Minute, and Second.
Use the sql temporal syntax, for example extract (year from ts ) Where ts is your timestamp value Niels
Iftikhar -- View this message in context: http://www.nabble.com/How-to-convert-time-from-seconds-to-Year-Month-Day...-... Sent from the monetdb-users mailing list archive at Nabble.com.
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl
Niels Thanks a lot for your reply. Actually the seconds e.g. "1087488000" are stored as number (longint), they are not stored as timestamp. In this case what should be the appropriate approach. Regards, Iftikhar Niels Nes wrote:
On Sun, Feb 10, 2008 at 04:00:41PM -0800, Iftikharn wrote:
Thanks to people out there for providing excellent answers.
I have time values in the form of seconds since 1970/01/01 00:00:00.000 GMT e.g. "1087488000".
ie you have timestamps?
How could I convert them into Year, Month, Day, Hour, Minute, and Second.
Use the sql temporal syntax, for example
extract (year from ts )
Where ts is your timestamp value
Niels
Iftikhar -- View this message in context: http://www.nabble.com/How-to-convert-time-from-seconds-to-Year-Month-Day...-... Sent from the monetdb-users mailing list archive at Nabble.com.
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
--
Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- View this message in context: http://www.nabble.com/How-to-convert-time-from-seconds-to-Year-Month-Day...-... Sent from the monetdb-users mailing list archive at Nabble.com.
On Mon, Feb 11, 2008 at 03:33:10AM -0800, Iftikharn wrote:
Niels
Thanks a lot for your reply.
Actually the seconds e.g. "1087488000" are stored as number (longint), they are not stored as timestamp.
In this case what should be the appropriate approach.
I added an extra sql file in src/sql, called temporal.sql. If this is loaded (on the latest stable) you get a function which can convert ints into timestamps. From this you can as said extract hours etc. The convert function is called epoch(int). There is also a new function epoch(timestamp) which returns the number of seconds since epoch. Niels
Regards,
Iftikhar
Niels Nes wrote:
On Sun, Feb 10, 2008 at 04:00:41PM -0800, Iftikharn wrote:
Thanks to people out there for providing excellent answers.
I have time values in the form of seconds since 1970/01/01 00:00:00.000 GMT e.g. "1087488000".
ie you have timestamps?
How could I convert them into Year, Month, Day, Hour, Minute, and Second.
Use the sql temporal syntax, for example
extract (year from ts )
Where ts is your timestamp value
Niels
Iftikhar -- View this message in context: http://www.nabble.com/How-to-convert-time-from-seconds-to-Year-Month-Day...-... Sent from the monetdb-users mailing list archive at Nabble.com.
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
--
Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- View this message in context: http://www.nabble.com/How-to-convert-time-from-seconds-to-Year-Month-Day...-... Sent from the monetdb-users mailing list archive at Nabble.com.
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl
participants (2)
-
Iftikharn
-
Niels Nes