connectseekers.com

Monday, 18 January 2016

Get Year, Month, Date From Date in SQL

1/18/2016 - By Pranav Singh 0

In this article I will show you how you can get the year,month and date from the given date in SQL by query.

Some of my previous queries are as follows: SQL Query To Drop or Delete All Table, View, Stored Procedure and Trigger, Date Time Formatting in C#.Insert, Update, Delete, Select, Drop and Create Table In Ms Sql Server Database Table.

So here is the query to get the year, month and day. In this we user date part in build function to get the year, month and day from the given date. Here are some the date part which is used for  getting the different parameters.

Parameter
Key
Year
yy, yyyy
Month
mm, m
Day
dd, d

YEAR:

SELECT DATEPART(yyyy,GETDATE()) AS FilterYear



MONTH:

SELECT DATEPART(MM,GETDATE()) AS FilterMonth




DAY:

SELECT DATEPART(DD,GETDATE()) AS FilterDay








About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top