用 C 添加时区格式的冒号
我想使用C语言在LoadRunner中打印日期时间。目前这就是我所拥有的。
Action()
{
lr_save_datetime("%Y-%m-%dT%H:%M:%S%z", DATE_NOW, "curr_dtm");
// this is -> 2022-03-08T10:25:09+0800
lr_output_message(lr_eval_string("{curr_dtm}"));
return 0;
}
我希望它像 2022-03-08T10:06:47+08:00 一样,其中时区带有冒号。
I want to print the date time in LoadRunner using C language. Currently this is what I have.
Action()
{
lr_save_datetime("%Y-%m-%dT%H:%M:%S%z", DATE_NOW, "curr_dtm");
// this is -> 2022-03-08T10:25:09+0800
lr_output_message(lr_eval_string("{curr_dtm}"));
return 0;
}
I want it to be like 2022-03-08T10:06:47+08:00 where the timezone has colon.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的。你有一个字符串,其中包含除冒号之外的所有内容。您有一个前 n-2 个字符的子字符串,该子字符串是正确的。您需要将另一个字符串附加到带有 ':00' 的该子字符串。
使用标准 C 字符串处理函数剪切出正确的子字符串,以所需格式附加一个字符串,并将其保存到新字符串。锻炼 C 编程技能!
OK. You have a string with everything except the colon. You have a substring of the first n-2 characters which are correct. You need to append another string to this substring with a ':00'
Use the standard C string processing functions to cut out the substring which is correct, append a string in the format you want, and save that to a new string. Exercise those C programming skills!