September 2, 2009 at 5:27 pm
Hi,
Does anyone know how I can return todays date in serial format from sql server ?
Thanks,
matt
September 2, 2009 at 5:38 pm
see
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 6, 2009 at 2:44 pm
Hi,
Thanks for the reply. I've had a look at the thread. I'm not sure it answers my question. I'm looking for the serial date like Excel produces, ie an integer representing the number of days since 1st Jan 1900. I need this as I am working with an application that records its dates in this format, and I was hoping that SQL Server had a similar function.
Many thanks,
Matt
September 6, 2009 at 3:14 pm
Would the following give the expected result?
SELECT DATEDIFF(dd,0,GETDATE())
However, it's interesting that EXCEL returns 40062 for today (2009-09-06), but SQL Server returns 40060...
September 6, 2009 at 3:43 pm
Thanks Lutz, this is exactly what I needed. The application uses the 0 date as Jan 1st 1801 so I have to do some conversion work anyway !
Matt
July 11, 2010 at 3:07 pm
lmu92 (9/6/2009)
Would the following give the expected result?SELECT DATEDIFF(dd,0,GETDATE())
However, it's interesting that EXCEL returns 40062 for today (2009-09-06), but SQL Server returns 40060...
The "0" date for for the default date serial numbers behind the scenes in Excel isn't 01/01/1900... it 12/31/1899. Further, Excel thinks that 2/29/1900 was a valid date (ccan you believe they still haven't fixed this stuff even after y2k happened???? :-P)
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply