将时间字符串转换为时间或数字格式 [英] Converting time string to time or numeric format
本文介绍了将时间字符串转换为时间或数字格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个格式为 00:00 00:30 01:00 的时间列.
I have a time column in the format of 00:00 00:30 01:00.
我想细分到特定时间,但我不明白如何将其转换为正确的格式
对于我使用的日期 as.date() 是否有类似的内容?
I want to subset to certain hours but I don't understand how to convert it to the right format
for the date i used as.date() is there someting similar?
推荐答案
很抱歉我明白了我使用了 strptime 和 strftime 函数,如下所示:
i am sorry i got it i used the strptime and strftime functions like so:
strftime(strptime(x, format="%H:%M"),"%H")
strftime(strptime(x, format="%H:%M"),"%H")
这篇关于将时间字符串转换为时间或数字格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文