473,750 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with showing time diff?

I have the following select:

select to_char((Log_Fo rtrykk.SistePla te::time -
OrdreNew.SisteP late::time)::in terval,'HH24:MI ') as diff from Log_Fortrykk

I need the output to be HH:MM, e.g. 00:09... But my prb is when this diff is less than 0,
it shows as 00:-9 and not -00:09

How can I fix this?
Regards,

BTJ

--
-----------------------------------------------------------------------------------------------
Bjørn T Johansen

bt*@havleik.no
-----------------------------------------------------------------------------------------------
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
-----------------------------------------------------------------------------------------------

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

Nov 23 '05 #1
1 2567
On Thu, Nov 11, 2004 at 11:55:33AM +0100, Bjørn T Johansen wrote:

select to_char((Log_Fo rtrykk.SistePla te::time -
OrdreNew.SisteP late::time)::in terval,'HH24:MI ') as diff from Log_Fortrykk

I need the output to be HH:MM, e.g. 00:09... But my prb is when this diff
is less than 0, it shows as 00:-9 and not -00:09


The documentation deprecates to_char(interva l, text) and the Release
Notes for 8.0 say that 8.1 will remove it.

You might be able to use substring():

SELECT substring('-00:09:10'::inte rval from '(.*):[0-9][0-9]$');
substring
-----------
-00:09
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #2

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

Similar topics

1
12344
by: NotGiven | last post by:
Below is a good elapsed time function I found. However, I'd like to return total seconds instead of broken down into days, hours, minutes & seconds. In other words, I want "125" instead of "2 minutes 5 seconds". Any ideas? Thanks very much! function calcElapsedTime($time) { // calculate elapsed time (in seconds!) $diff = time()-$time;
1
1588
by: erica | last post by:
Hi, I am having a very strange problem. I wrote a program in php 4.3.10 that uses objects. My classes.inc file looks like this: <?php // Coordinate class class Coord {
2
3707
by: Alberto Santini | last post by:
I ported a Jos Stam's demo about Fluid mech to check the difference of speed between C implementation and Python. I think I achieved good results with Python and there is space to improve, without to extend the program with C routine, I mean. -- Good hack, Alberto Santini (http://www.albertosantini.it/)
4
2415
by: Gactimus | last post by:
Hey again, I am working my way through the book "C++ Primer Fourth Edition". I am trying to run a program out of the book using Microsoft Visual C++ version 6 and I am given the error message: : error C2248: 'hours' : cannot access private member declared in class 'Time' : error C2248: 'minutes' : cannot access private member declared in class 'Time'
3
1688
by: questions? | last post by:
I have a problem involves under flow/over flow. ################################################### # include <stdio.h> # include <math.h> # include <stdlib.h> double rate; double t; double u;
6
2431
by: Jeremy Sanders | last post by:
Hi - I need to add support to a program for dates and times. The built-in Python library seems to be okay for many purposes, but what I would like would be Unix epoch style times (seconds relative to some date), covering a large period from the past to the future. What would be nice would be a library which can take floating point seconds from an epoch. Does anyone know of a library which can convert from human style dates and times to a...
9
8299
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the following to try to determine which. import time # Determine if time.time is better than time.clock # The one with better resolution should be lower.
1
1043
by: latanivandikar | last post by:
In asp.net How to display records satisfying particular conditions from one table only in diff DIV eg. using only one table we have to display diff. records in diff.DIV. according to particular column value. eg. in one DIV show records from table1 where empno between(1-8) in other DIV show records from same table whee empno between(8-14) and so on. how I can do this? whether i have to write diff. query for diff DIV or what?
6
3316
by: Aaron Gray | last post by:
Hi, I am working on an HTML WYSISYG Wiki and need to display a diff page like WikiPedia does if two people edit a file at the same time to give the second user the diff. Basically with additions in red and deletions in red strike though. There seem to be several in Perl and Python and many diff programs which all seem to be line based and work on text written in PHP.
0
9001
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
9583
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
9396
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6081
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
4716
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...
1
3323
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
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2226
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.