本文介紹了在 C++ 中將字符串轉換為日期的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我知道這可能很簡單,但作為 C++,我懷疑它會如此.如何將 01/01/2008 形式的字符串轉換為日期以便我可以操作它?我很高興將字符串分解為日月年組成部分.如果解決方案僅適用于 Windows,也很高興.
I know this may be simple but being C++ I doubt it will be. How do I convert a string in the form 01/01/2008 to a date so I can manipulate it? I am happy to break the string into the day month year constituents. Also happy if solution is Windows only.
推薦答案
#include <time.h>
char *strptime(const char *buf, const char *format, struct tm *tm);
這篇關于在 C++ 中將字符串轉換為日期的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!