Is there any method in MFC to convert date in the format (yyyy-mm-dd) to (dd-mm-yyyy). The date is given as an input ,where the user type the date in yyyy-mm-dd format . Thanks in advance.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you know the input string is in “yyyy-mm-dd” format, then you can do a simple string rewrite of the form:
If the input string is not formatted that nicely, then you will actually need to parse the date string, which is a harder problem.
The standard way to do that is using strptime(), as discussed in:
Convert a string to a date in C
where the format string would look like “%Y-%m-%d”.
Once you have the date, you could print it using something like: