473,657 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

interval to seconds conversion. How?

How can I calculate the number of second in some interval? Neither
the secods part, nor the seconds after midnight... Just the full
quantity of the seconds. I haven't find any function.

Thanks in advance.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #1
6 19910
On Thu, Oct 28, 2004 at 04:08:53AM +0600, Denis Zaitsev wrote:
How can I calculate the number of second in some interval? Neither
the secods part, nor the seconds after midnight... Just the full
quantity of the seconds. I haven't find any function.

Thanks in advance.


Oh, I'm sorry. This is extract(epoch from interval).

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
Denis Zaitsev <zz*@anda.ru> writes:
How can I calculate the number of second in some interval? Neither
the secods part, nor the seconds after midnight... Just the full
quantity of the seconds. I haven't find any function.


EXTRACT(EPOCH FROM interval_value)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #3
On Wed, Oct 27, 2004 at 06:30:24PM -0400, Tom Lane wrote:
Denis Zaitsev <zz*@anda.ru> writes:
How can I calculate the number of second in some interval? Neither
the secods part, nor the seconds after midnight... Just the full
quantity of the seconds. I haven't find any function.


EXTRACT(EPOCH FROM interval_value)


Yes, I've already found it... :) Thanks anyway.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 23 '05 #4
On Thu, Oct 28, 2004 at 04:08:53AM +0600, Denis Zaitsev wrote:
How can I calculate the number of second in some interval? Neither
the secods part, nor the seconds after midnight... Just the full
quantity of the seconds. I haven't find any function.


I think you can do that using

EXTRACT(epoch FROM interval-value)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The problem with the future is that it keeps turning into the present"
(Hobbes)
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #5
On Thu, 2004-10-28 at 04:08 +0600, Denis Zaitsev wrote:
How can I calculate the number of second in some interval? Neither
the secods part, nor the seconds after midnight... Just the full
quantity of the seconds. I haven't find any function.

Thanks in advance.


SELECT extract(epoch FROM n);

n = interval

-Robby

--
/*************** *************** *********
* Robby Russell | Owner.Developer .Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | ro***@planetarg on.com
* 503.351.4730 | blog.planetargo n.com
* PHP/PostgreSQL Hosting & Development
* --- Now supporting PHP5 and PHP4 ---
*************** *************** **********/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBBgCT60Qa QZBaqXgwRAkqNAK C87oW/FxqFqxwliH3x86T IB1/zFACgv07v
2mHPFzhKbu4RuJB WpvRxW2E=
=ftX+
-----END PGP SIGNATURE-----

Nov 23 '05 #6
On Thu, Oct 28, 2004 at 04:08:53AM +0600, Denis Zaitsev wrote:
How can I calculate the number of second in some interval? Neither
the secods part, nor the seconds after midnight... Just the full
quantity of the seconds. I haven't find any function.


test=> SELECT extract(epoch FROM '5 hours 42 minutes 35 seconds'::INTER VAL);
date_part
-----------
20555

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2967
by: Andrew Poulos | last post by:
How do I convert a length of time, measured in seconds, into a "point in time" type time interval or what's represented as: time (second,10,2) The format is: PS]] where: y: The number of years (integer, >= 0, not restricted) m: The number of months (integer, >=0, not restricted) d: The number of days (integer, >=0, not restricted)
10
2255
by: Karsten Hilbert | last post by:
I have the need to output intervals (ages in this case). PostgreSQL takes great care to handle months correctly (eg take into account varying months lengths). This is only possible if either end point or start point of an interval are known. For post processing some of the ambiguity of what "2 mons" means would be removed if "61 days" was returned. Is there a way to tell PostgreSQL to return that type of interval (eg use weeks, days,...
1
7142
by: Liviu BURCUSEL | last post by:
Hello ! It is late night and I cannot think right anymore. Please help me to convert a interval like '2 days 00:22:10.2905' in seconds. Thank you very much in advance, Liviu ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your
1
1987
by: Ed Smith | last post by:
The Postgres INTERVAL literal is not compliant with the ANSI 2003 SQL Spec. Here's the Postgres way: # select INTERVAL '45 DAY'; interval ---------- 45 days (1 row) The spec. says
13
2848
by: Bruno Wolff III | last post by:
Recently there has been some discussion about attaching a timezone to a timestamp and some other discussion about including a 'day' part in the interval type. These two features impact each other, since if you add a 'day' to a timestamp the result can depend on what timezone the timestamp is supposed to be in. It probably makes more sense to use a timezone associated with the timestamp than say the timezone GUC or the fixed timezone UTC. ...
21
55926
by: Tark Siala | last post by:
hi i am using timer control, its good but if my event doing less than one time in 1 Minute. i want make event every 5 minute, how i can do that? i am using VB6, VB.NET -- Best Regards
3
1832
by: eur.van.andel | last post by:
Hi all How can I access partial seconds on the system clock? I measure air speed and water flow in a heat-exchanger test stand and count pulses from both water meter and air speed meter. I divide the amount of these counts over a certain interval with the time of that interval. Since I only have seconds, I need to wait 100 seconds for may calculation is I want a precision of 1%.
6
6579
by: alexs | last post by:
hi, I'm moving a mysql database over to using db2 V9.5 The database is used by our radius server to store network accounting information from our switches. One parameter is the length of a network session in seconds. In mysql there is a sec_to_time function which i then used to store the session time as a char string
0
1193
by: Hendrik van Rooyen | last post by:
Lawrence D'Oliveiro wrote: The above is an endless loop, doing something every five seconds, and something else in the in between times. I don't think you are dense - its a good point, leading to the following analysis: The do_the_in_between_stuff call either takes less than, or more than, or exactly five
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.