Welcome
Welcome to <strong>Sybase Philippines</strong>.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>!

Time functions

Updated with the latest technology, this powerful, industry-leading rapid application development tool offers tight integration between design, modeling, development and management. PowerBuilder enables developers to build anything from two-tier and Web applications to applications for a distributed architecture.

Time functions

Postby mrg on Fri Dec 21, 2007 5:03 am

Hi to all programmers ,

I'm having a hard time computing the hours(in decimal) between two different dates (datatype for both is datetime) because the maximum allowed for time is 23:59. for example,
time in : 12/10/2007 22:00
timeout : 12/11/2007 06:30
this should output 8.30 hours

thanks. :)
mrg
 
Posts: 1
Joined: Fri Dec 21, 2007 4:59 am

Postby Erick Ilo on Mon Dec 24, 2007 3:00 am

Hi!

1) Make sure Date of TimeIn Occurs Before Date of TimeOut
2) (DaysAfter(timein, timeout) * (3600*24) + SecondsAfter(timein, timeout)) / 3600


This logic will return the seconds difference between timein timeout :idea:

PS: i made corrections from my previous post to address multiple DaysAfter :oops:
Erick Ilo
 
Posts: 3
Joined: Fri Aug 17, 2007 3:17 am
Location: Manila, Philippines

Getting Time Difference between two dates

Postby SaimaShirani on Tue Jan 01, 2008 10:59 am

SaimaShirani
 
Posts: 5
Joined: Tue Nov 27, 2007 4:13 am

Postby kymel15 on Tue Jul 29, 2008 7:32 am

check this out:

Convert(numeric(4,2), datediff(mi,"TimeIn", "TimeOut")/60.00)

ex.

Convert(numeric(4,2), datediff(mi,"09:30 AM", "06:00 PM")/60.00)

returns 8.50

NOTE:
Unauthorized copy and pasting this code may result to criminal charges :twisted:
kymel15
 
Posts: 4
Joined: Tue Jul 29, 2008 6:36 am


Return to PowerBuilder

Who is online

Users browsing this forum: No registered users and 0 guests

cron