469,353 Members | 2,053 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

how to convert date time format as yyyyddmm hh:mm:ss in c#?

nirmalsingh
218 100+
i am getting date format in string as 30-11-2006 05:59:44 PM . i want to convert in the format of yyyy-mm-dd hh:mm:ss to sore it in mysql database.
Help me with sample coding plz..
Jan 5 '07 #1
5 18874
kenobewan
4,871 Expert 4TB
Try placing your date in a string and then form it:
Expand|Select|Wrap|Line Numbers
  1. myDate.ToString("yyyy-MM-dd hh:mm:ss")
OR
Expand|Select|Wrap|Line Numbers
  1. myDate.DateFormat = "yyyy-MM-dd hh:mm:ss";
Hope that this helps.
Jan 5 '07 #2
DateTime.Now.ToString("yyyy/MM/dd HH:MM")
Jan 5 '07 #3
radcaesar
759 Expert 512MB
Try with,

DateTime.CustomFormat()

:)
Jan 5 '07 #4
nirmalsingh
218 100+
its rarely working well with
myDate.ToString("yyyy-MM-dd hh:mm:ss")
but i have an error often as internal server error
Jan 5 '07 #5
kenobewan
4,871 Expert 4TB
May be unrelated:
500 Internal Server Error Resolution

But suggest you post code in case. Does error give you a line number?
Jan 5 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by hikums | last post: by
2 posts views Thread by Robert Brown | last post: by
5 posts views Thread by kpp9c | last post: by
1 post views Thread by Nerds | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.