User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 391,952 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,813 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 6160 | Replies: 4
Reply
Join Date: Oct 2005
Posts: 3
Reputation: bradleyc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bradleyc bradleyc is offline Offline
Newbie Poster

sql*plus or pl/sql question

  #1  
Oct 23rd, 2005
How would you calculate the difference between two dates?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: El Paso, TX
Posts: 225
Reputation: extofer is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Re: sql*plus or pl/sql question

  #2  
Oct 23rd, 2005
Originally Posted by bradleyc
How would you calculate the difference between two dates?

use DATEDIFF(datepart,startdate,enddate)
the datepart is the part of the date you want the difference of, days, months, years.
Reply With Quote  
Join Date: Oct 2005
Posts: 3
Reputation: bradleyc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bradleyc bradleyc is offline Offline
Newbie Poster

Re: sql*plus or pl/sql question

  #3  
Oct 23rd, 2005
so apparently i do something like ..
SELECT DATEDIFF(dd, '12/5/2002 22:00', '12/6/2002 09:00')

can i do something like
SELECT DATEDIFF(dd, DateOfRego, CaseClosed)
Reply With Quote  
Join Date: Aug 2005
Location: El Paso, TX
Posts: 225
Reputation: extofer is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Solution Re: sql*plus or pl/sql question

  #4  
Oct 23rd, 2005
Originally Posted by bradleyc
so apparently i do something like ..
SELECT DATEDIFF(dd, '12/5/2002 22:00', '12/6/2002 09:00')

can i do something like
SELECT DATEDIFF(dd, DateOfRego, CaseClosed)

you can do that, so long as you assign appropriately either pl-sql, PHP or ASP. What are you running on??

sample...
DateOfRego="12/5/2002 22:00"
CaseClosed="12/6/2002 09:00"


SELECT DATEDIFF(dd, '" & DateOfRego & "', '" & CaseClosed & "')
Reply With Quote  
Join Date: Oct 2005
Posts: 3
Reputation: bradleyc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bradleyc bradleyc is offline Offline
Newbie Poster

Re: sql*plus or pl/sql question

  #5  
Oct 23rd, 2005
DateOfRego="12/5/2002 22:00"
CaseClosed="12/6/2002 09:00"

What if thet are based simply on dates, no times?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 9:05 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC