Comment construire un datetime ISO 8601 en C++ ?
Comment construire un datetime ISO 8601 en C++ ?
Comment construire un datetime ISO 8601 en C++ ?
Re: Comment construire un datetime ISO 8601 en C++ ?
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
```
#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