有解析字符串到时间结构的建立方式?
Is there an established way to parse a string to a Time structure?
我想最好做的是的strftime(...),其中,而不是从时间结构和格式字符串产生一个字符串,我得到的反时间结构从根据所提供的格式字符串解析的串
What I would ideally like to do is the reverse of strftime(...), where instead of producing a string from a time struct and format string, I get a time struct from a string parsed according to the provided format string.
我preFER不通过包括DateTime类来添加额外的开销,如在升压找到或.NET
I would prefer not to add additional overhead by including a DateTime class such as that found in Boost or .NET
推荐答案解析字符串结构TM相应的方法* 是的 strptime 。
The corresponding method for parsing strings to struct tm * is strptime.
不幸的是,这不是标准的C运行时库的一部分,例如上不存在窗户,但你可以重新使用BSD授权的版本,如这个。
Unfortunately this isn't part of the standard C runtime library and doesn't exist on e.g. windows, but you can reuse a BSD-licensed version, such as this one.
更多推荐
如何解析字符串到的ctime结构?
发布评论