用 C 添加时区格式的冒号

发布于 2025-01-12 09:33:17 字数 320 浏览 1 评论 0原文

我想使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花落人离去 2025-01-19 09:33:17

好的。你有一个字符串,其中包含除冒号之外的所有内容。您有一个前 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文