在字符串转换为时间格式在C [英] convert a string in to time format in c

查看:98
本文介绍了在字符串转换为时间格式在C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个字符串2011-08-21 21点48分45秒+ 1200,和另一个相同的格式,结果
我想比较这两个字符串,找出哪一个是一个早期或更高版本之一,结果
有没有一种简单的方法来将字符串转换为时间格式,而不是字符比较它们?
谢谢

suppose I have a string "2011-08-21 21:48:45 +1200",and another one with the same format,
I want to compare these 2 strings to find out which one is the early one or later one,
is there a easy way to convert a string to time format rather than compare them by characters? Thanks

推荐答案

使用 GETDATE strptime()

这篇关于在字符串转换为时间格式在C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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