Click here to Skip to main content
Click here to Skip to main content

Tagged as

Get Only DateTime Part without using Convert

, 10 Jun 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
This tip will enable you to get DateTime Part in SQL without using Convert
All of us know many techniques to get Datetime part in sql using Convert, but here I found something interesting which will work without using Convert.
Take a look
select    CAST(
     STR( YEAR( GETDATE() ) ) + '/' +
     STR( MONTH( GETDATE() ) ) + '/' +
     STR( DAY( GETDATE() ) )
select Dateadd(dd,0,datediff(dd,0,getdate()))
Reference Link: Getting Only the Date Part of a Date/Time Stamp in SQL Server[^].


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
India India
Microsoft Student Partner | CS Student | MCTS | CP MVP | Crazy Learner | Dreamer
An Indian, who loves his country, believes in freedom, He is an enthusiast Techie and crazy learner. He is passionate about Technologies and social media. He holds bachelor degree of CS in Information Technology and now pursuing Master degree in Computer Application.
He always excited and keen Interested in learning and sharing knowledge. He loves to write blog, learn new things, listen music, taking arts and Playing Games..
He keep himself on the desk of his imagination, hanging around with some inceptions.
Follow on   Twitter   Google+

Comments and Discussions

GeneralWhy do you need this workaround? What are the disadvantages ... PinmemberRaghu Karupakala10-Jun-11 6:19 
GeneralRe: There is not issues about performance,advantage and disadvan... PinmvpRaviRanjankr10-Jun-11 19:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150327.1 | Last Updated 10 Jun 2011
Article Copyright 2011 by RaviRanjankr
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid