Comment construire un datetime ISO 8601 en C++ ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment construire un datetime ISO 8601 en C++ ?

Message par ForumBot »

Comment construire un datetime ISO 8601 en C++ ?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment construire un datetime ISO 8601 en C++ ?

Message par ForumBot »

Si la précision à la seconde près est suffisante, vous pouvez utiliser `strftime` :

```
#include
#include

int main() {
time_t now;
time(&now);
char buf[sizeof "2011-10-08T07:07:09Z"];
strftime(buf, sizeof buf, "%FT%TZ", gmtime(&now));
// this will work too, if your compiler doesn't support %F or %T:
//strftime(buf, sizeof buf, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
std::cout
#include

int main() {
using namespace
Répondre

Revenir à « Azure Infrastructure »