Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Time Difference function

4 posts in General Discussion Last posting was on 2005-12-27 08:10:50Z
Mark Posted on 2005-12-23 20:02:06Z
Sender: 4977.43ac54b6.1804289383@sybase.com
From: Mark
Newsgroups: sybase.public.powerbuilder.general
Subject: Time Difference function
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <43ac5559.4984.1681692777@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 23 Dec 2005 11:51:53 -0800, 10.22.241.42
Lines: 9
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 23 Dec 2005 11:51:54 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 23 Dec 2005 12:02:06 -0800
X-Trace: forums-1-dub 1135368126 10.22.108.75 (23 Dec 2005 12:02:06 -0800)
X-Original-Trace: 23 Dec 2005 12:02:06 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:188727
Article PK: 639976

Is there a built in powerbuilder function that will compare
2 time values and give me the difference in minutes or
hour:mins??

I can't seem to find one.

Thanks,

Mark


"Pat Madigan" <patm Posted on 2005-12-23 21:05:35Z
From: "Pat Madigan" <patm@_nospamforme_gscutah.com>
Newsgroups: sybase.public.powerbuilder.general
References: <43ac5559.4984.1681692777@sybase.com>
Subject: Re: Time Difference function
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
X-Original-NNTP-Posting-Host: mail.gscutah.com
Message-ID: <43ac6434$1@forums-2-dub>
X-Original-Trace: 23 Dec 2005 12:55:16 -0800, mail.gscutah.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 23 Dec 2005 12:55:17 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 23 Dec 2005 13:05:35 -0800
X-Trace: forums-1-dub 1135371935 10.22.108.75 (23 Dec 2005 13:05:35 -0800)
X-Original-Trace: 23 Dec 2005 13:05:35 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:188729
Article PK: 639977

There's some stuff in the PFC that will get you there, like of_secondsafter
in n_cst_datetime.

For the hh:mm formatting, I use a simple function like this, in this case
with an argument of fa_hours (decimal) and a returned string.

decimal {6} ld_hours, ld_minutes
long ll_hours, ll_minutes
string ls_time

if isnull(fa_hours) then
return "0:00"
end if

ld_hours = fa_hours
ld_minutes = fa_hours*60.0
ll_hours = truncate(ld_hours,0)
//truncated this to prevent roundup ( to avoid HH:60)
ll_minutes = truncate(mod(ld_minutes,60),0)

if ld_hours < 0.0 then
ls_time = "-" + string(abs(ll_hours),"#0")+":"+string(abs(ll_minutes),"00")
else
ls_time = string(ll_hours,"#0")+":"+string(ll_minutes,"00")
end if

return ls_time


Pat

<Mark> wrote in message news:43ac5559.4984.1681692777@sybase.com...
> Is there a built in powerbuilder function that will compare
> 2 time values and give me the difference in minutes or
> hour:mins??
>
> I can't seem to find one.
>
> Thanks,
>
> Mark


Hans Groeneveld Posted on 2005-12-27 08:10:50Z
From: "Hans Groeneveld" <h.groeneNOveld@tsdSPAM.nl>
Newsgroups: sybase.public.powerbuilder.general
References: <43ac5559.4984.1681692777@sybase.com>
Subject: Re: Time Difference function
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.326
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.326
NNTP-Posting-Host: wc-236.r-195-35-217.essentkabel.com
X-Original-NNTP-Posting-Host: wc-236.r-195-35-217.essentkabel.com
Message-ID: <43b0f70a@forums-1-dub>
Date: 27 Dec 2005 00:10:50 -0800
X-Trace: forums-1-dub 1135671050 195.35.217.236 (27 Dec 2005 00:10:50 -0800)
X-Original-Trace: 27 Dec 2005 00:10:50 -0800, wc-236.r-195-35-217.essentkabel.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:188744
Article PK: 639985

You can use the date and time functions of ASA.

SELECT DATEDIFF(minute, :ldt_timestap_1, :ldct_timestamp_2) INTO
:ldt_minutes) ;

<Mark> wrote in message news:43ac5559.4984.1681692777@sybase.com...
> Is there a built in powerbuilder function that will compare
> 2 time values and give me the difference in minutes or
> hour:mins??
>
> I can't seem to find one.
>
> Thanks,
>
> Mark