1 | // |
---|---|
2 | // DateTime.cpp |
3 | // |
4 | // This sample demonstrates the DateTime class. |
5 | // |
6 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
7 | // and Contributors. |
8 | // |
9 | // SPDX-License-Identifier: BSL-1.0 |
10 | // |
11 | |
12 | |
13 | #include "Poco/LocalDateTime.h" |
14 | #include "Poco/DateTime.h" |
15 | #include "Poco/DateTimeFormat.h" |
16 | #include "Poco/DateTimeFormatter.h" |
17 | #include "Poco/DateTimeParser.h" |
18 | #include <iostream> |
19 | |
20 | |
21 | using Poco::LocalDateTime; |
22 | using Poco::DateTime; |
23 | using Poco::DateTimeFormat; |
24 | using Poco::DateTimeFormatter; |
25 | using Poco::DateTimeParser; |
26 | |
27 | |
28 | int main(int argc, char** argv) |
29 | { |
30 | LocalDateTime now; |
31 | |
32 | std::string str = DateTimeFormatter::format(now, DateTimeFormat::ISO8601_FORMAT); |
33 | DateTime dt; |
34 | int tzd; |
35 | DateTimeParser::parse(DateTimeFormat::ISO8601_FORMAT, str, dt, tzd); |
36 | dt.makeUTC(tzd); |
37 | LocalDateTime ldt(tzd, dt); |
38 | return 0; |
39 | } |
40 |