.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> WPF >> Post New QuestionBookmark and Share Subscribe to Forum

how to get only year from datetime datatype..

Posted By: Jayakumar     Posted Date: April 08, 2010    Points:2   Category :WPF

i assigned datetime datatype for an column(year).

if the user enter the year in the textbox(year column)
it appears as " mm/dd/yy " format..
i nedd only year from this to be saved into my db when user enter the year...

this is for wpf windows applciation,c#...


Author: Suresh             
Posted Date: April 09, 2010     Points: 5   

Go through the below code
Select datepart(yyyy,getdate())

Author: SureshM             
Posted Date: November 26, 2010     Points: 5   

Select datepart(yyyy,getdate())
the above query will only retrive, but it will not store only the year.

if you use the DateTime datatype, it will store this format "mm/dd/yy"
You can use varchar or char.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend