What is an easy way to parse a date Http Header in

2019-02-25 16:07发布

问题:

I want to parse an email http date header, is there an easy way to do it without writing my own string parsing functions?

Example:

Date: Fri, 19 Mar 2010 11:44:02 -0700

To clarify, parsing out the Date: part is easy, im talking about the actual date string. Ideally, id like to get the epoch time.

回答1:

If it's available in your target system (eg Linux) you can use strptime.