A string “2012-03-02” representing March 2nd, 2012 is given to me as an input variable (char *).
How do I convert this date into unix epoch time in C programming language?
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.
C (POSIX) provides a function for this. Use
strptime()to convert the string into astruct tmvalue. You can then convert thestruct tmintotime_tusingmktime().