Home > Archive > ASE Database forum > April 2005 > get first day of the month?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author get first day of the month?
VMI

2005-04-04, 8:05 pm

How can I get the first day of the month? If someone gives
me '3/25/2005', how can I get '3/1/2005'?

A possible solution for SQL server was: select DATEADD(mm,
DATEDIFF(mm,0,getdat
e()), 0) but I don't think 0 is
recognized as a valid parm in DATEDIFF.

Thanks.
Robert Densmore

2005-04-04, 8:05 pm

One possible way:

select
dateadd(dd, -1 * (datepart(dd,getdate
()) -1), getdate())

Bob

On 4 Apr 2005 08:56:13 -0800, VMI wrote:

>How can I get the first day of the month? If someone gives
>me '3/25/2005', how can I get '3/1/2005'?
>
>A possible solution for SQL server was: select DATEADD(mm,
> DATEDIFF(mm,0,getdat
e()), 0) but I don't think 0 is
>recognized as a valid parm in DATEDIFF.
>
>Thanks.


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com