Get the App
SLTechnology News&Howtos  ›  Development  › 

How to convert timestamp into time in C language

Shulou Source: shulou.com Published: 2022-06-03 14:05:21 11月14日 Update

This article introduces the knowledge of "how to convert timestamps into time in C language". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

# include # include int isNumber (char * NUM) / / check for a number,ture return non-0,false return 0; {int ret = 0; int ct=0; for (ct=0; ct 2) {printf ("The parameter is only onetimbers!\ n"); ret = 1; goto End;} else if (argc < 2) {printf ("The program need a parameterized!\ n") Ret = 2; goto End;} if (isNumber (argv [1]) = = 0) {printf ("The parameter must be numbered codes!\ n"); ret = 3; goto End;} if (strlen (argv [1])! = 10) {printf ("The parameter is not good timestamps!\ n"); ret = 4; goto End } tt= atoi (argv [1]); p = localtime (& tt); strftime (str, 1024, "% F% T", p); printf ("% s\ n", str); End: if (str! = NULL) {free (str);} if (str! = NULL) {free (p);} return ret This is the end of the introduction of "how to convert timestamps into time in C language". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Time language content more knowledge practicality achievement and then dilemma reality situation article case editing website industry process high quality learning related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi Shulou Technology Redmi Shulou Tech Info