DateTime Year stores different,Sql server 2008 R2

Posted by Raja_89 under Sql Server on 7/20/2015 | Points: 10 | Views : 290 | Status : [Member] | Replies : 2
Hai


Sql server 2008 R2 as my sql server .

I am saving value from datetimepicker which gives date only .While i am viewing in db it shows an year 1905-07-10 instead of 2015-07-10 .

Front end-C# winform
How can i resolve it




Responses

Posted by: Sheonarayan on: 7/20/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
You will need to format the date before sending to save into the database. If you are getting only date, format with "yyyy-MM-dd" and then send to save into the database and it would work.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja_89 on: 7/24/2015 [Member] Starter | Points: 25

Up
0
Down
HI
Thanks for your reply

I am assigning to a vairable from datetime picker
string a =Convert.tostring(Dt.value.tostring("yyyy-MM-dd"))

In Db
dt datetime as type

While retriving i am seeing as
1905-06-24 00:00:00.000
in my db


Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response