Dear All,
I can insert data into mysql db already via my C codes. The only problem now I need insert the time in this format "2011-12-11 09:01:02". How can I format this in my C codes? Thank you.

Recommended Answers

All 2 Replies

man strftime. The format string you need is "%Y-%m-%d %H:%M:%S".

Dear Nezachem,
So normally in C if I put %d then at the end I must put a variable corresponding to it right? So will it be in this case?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.