在Win32中解析字符串中的日期 [英] Parse a Date from a String in Win32

查看:149
本文介绍了在Win32中解析字符串中的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含日期的字符串,另一个包含第一个字符串的日期格式的字符串。有一个函数,我可以调用来将该日期转换成类似SYSTEMTIME结构的东西?基本上,我想与 GetDateFormat()

I have a string containing a date, and another string containing the date format of the first string. Is there a function that I can call to convert that date into something like a SYSTEMTIME structure? Basically, I'd like the opposite of GetDateFormat().

推荐答案

不,但你可以编写一个函数,将日期格式字符串转换为sscanf格式字符串和系列的变量。然后将数据从变量复制到systemtime结构,你就全部设置。

No, but you can write a function that will convert the date format string into a sscanf format string and series of variables. Then copy the data from the variables to the systemtime structure and you're all set.

这不是微不足道,但它可能是最灵活的安排,如果你必须支持很多不同的日期格式。

It's not trivial, but it is probably the most flexible arrangement if you must support many different date formats.

这篇关于在Win32中解析字符串中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆