Convert to mm/dd/yyyy to yyyymmdd

Posted by Senthilmcatyr under ASP.NET on 1/29/2012 | Points: 10 | Views : 10718 | Status : [Member] | Replies : 3
I get value date format mm/dd/yyyy from datetime picker in text box. But i used database datetime format yyyymmdd. how to i covert code behind page in asp.net? if anybody pls help




Responses

Posted by: Arefin on: 1/29/2012 [Member] Starter | Points: 25

Up
0
Down
Just see the below link. Whatever format you want...
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

Thanks,
Arefin

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

Posted by: Blessyjees on: 1/29/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Check your date picker control to set the date format. We can set the format of the date in most of the date picker controls. Or you can try like this
textBox1.Text = DateTime.Today.ToString("yyyyMMdd");

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

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

Posted by: Hmanjarawala on: 1/30/2012 [Member] Bronze | Points: 25

Up
0
Down
Do one thing
when you datetime value pases to database at that time use Convert function of Sql.
Convert(Varchar(8), '<your-datetime-value>', format)

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

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

Login to post response