all groups > sql server (alternate) > may 2004 >
You're in the

sql server (alternate)

group:

Date functions



Date functions Jenny
5/21/2004 12:58:00 PM
sql server (alternate):
Hi all,

Are there a functions for last day of the month or first day of the month?

Thanks in advance,

Jen


--
Fast Track On Line -Web Design and Development
Portfolio http://www.fasttrackonline.co.uk


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.688 / Virus Database: 449 - Release Date: 18/05/2004

Re: Date functions John Gilson
5/21/2004 1:31:49 PM
[quoted text, click to view]

Last day of month:

SELECT DATEADD(MONTH, 1, CURRENT_TIMESTAMP) -
DAY(DATEADD(MONTH, 1, CURRENT_TIMESTAMP))

First day of month:

SELECT CURRENT_TIMESTAMP - DAY(CURRENT_TIMESTAMP) + 1

--
JAG

Re: Date functions Viktor Pryganov
5/21/2004 5:09:08 PM
Hi, Jenny!
You wrote on Fri, 21 May 2004 12:58:00 +0100:
J> Are there a functions for last day of the month
dateadd(month,1,dateadd(day,-day(getdate())+1,getdate()))
J> or first day of the month?
dateadd(day,-day(getdate())+1,getdate())

J> Thanks in advance,
NE ZA CHTO, ZAKHODITE ESCHYO!

J> Jen

-
exexe!

AddThis Social Bookmark Button