-
MS SQL Server 7.0 system datetime
Hi there,
Is it possible that the the select getdate() only shows date portion with
real value but shows the time portion with 00:00:00.000. If so, at what situation.
How can it be changed to show the real date and time like 09/04/00 3:30:00.000.
I think it has something to do with the MS SQL server system setting or
SQL setting, but I do not know how to change it. Please help!
Tony
-
Re: MS SQL Server 7.0 system datetime
Tony,
> Is it possible that the the select getdate() only shows date portion with
> real value but shows the time portion with 00:00:00.000. If so, at what situation.
> How can it be changed to show the real date and time like 09/04/00 3:30:00.000.
> I think it has something to do with the MS SQL server system setting or
> SQL setting, but I do not know how to change it. Please help!
Q. Is there a DATE function for SQL Server? I don't want to hold the time.
A. No, the SQL Server datetime format always holds both a date and a time. If you
wish you can 'strip out' the time by setting it to 00:00:00.000 by using :-
SELECT CONVERT(DATETIME,CONVERT(CHAR(10),GETDATE(),101))
===
v1.01 2000.04.18
Applies to SQL Server versions : All
FAQ Categories : Application Design and Programming
Related FAQ articles : n/a
Related Microsoft Kb articles : n/a
Other related information : "Date and Time Functions" in Books Online
Authors : Neil Pike
Neil Pike MVP/MCSE. Protech Computing Ltd
Reply here - no email
SQL FAQ (484 entries) see
forumsb.compuserve.com/gvforums/UK/default.asp?SRV=MSDevApps (faqrtf.zip - L7 - SQL
Public)
or http://www.ntfaq.com/Section.cfm?sectionID=34
or www.sqlserverfaq.com
or www.mssqlserver.com/faq
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks