Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current date only

Status
Not open for further replies.

netcert

Programmer
Apr 11, 2001
115
US
I'm trying to get the current system date without the time. I know I can use GetDate() but I don't want the time portion.

Isn't there a separate function just for date or am I going to have to use the convert syntax to pull it out?

What would the syntax be?
 
Read this... faq183-5842

Particulary item #7.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Actually de-de-de-deja-vu (sfx on) :p

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
I just now read that other thread. I swear it's true. [bigsmile]

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
what i'm really looking for is a way to pull records that were updated on the current date only. This script would only pull those records who were last updated, today, for example.

select * from name where last_updated = current date only

The Last_Updated field is a datetime so I only want to compare the date portion with the date portion of todays date, minus the time.

The FAQ you all referenced was helpful but maybe i'm just not getting it.

Thx.
 
In the FAQs...

DATEADD(dd, DATEDIFF(dd, 0, [!]GETDATE()[/!]), 0)

so...
Code:
select * 
from   name 
where  DATEADD(dd, DATEDIFF(dd, 0, [!]last_updated[/!]),0) 
          = DATEADD(dd, DATEDIFF(dd, 0, [!]GETDATE()[/!]), 0)

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Um... bye-bye SARG

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top