Comment construire un datetime ISO 8601 en C++ ?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Comment construire un datetime ISO 8601 en C++ ?

Message par Clippy »

Comment construire un datetime ISO 8601 en C++ ?
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

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

Message par Clippy »

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 »