开发者

Unix timestamp to XML date time conversion

Is there any C++ Library api available which converts Unix timestamp to XML datatype datetime

eg :

http://books.xmlschemata.org/relaxng/ch19-77049.html

I am looking to convert into pattern : 2001-10-26T19:32:52+00:00

I also have access t开发者_如何学Co mysql, so I can get hold of :

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2010-09-28 14:47:47 | 
+---------------------+

I could not find any formatting functions which would fit this.

I just don't prefer string manipulation for this , unless there is no way out....

Cheers!


You could use the strftime() function from <time.h>:

char time_buf[21];
time_t now;
time(&now);
strftime(time_buf, 21, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜