472,103 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,103 software developers and data experts.

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 18998
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.