forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDateTime.cpp
More file actions
41 lines (34 loc) · 898 Bytes
/
DateTime.cpp
File metadata and controls
41 lines (34 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// DateTime.cpp
//
// $Id: //poco/1.4/Foundation/samples/DateTime/src/DateTime.cpp#1 $
//
// This sample demonstrates the DateTime class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/LocalDateTime.h"
#include "Poco/DateTime.h"
#include "Poco/DateTimeFormat.h"
#include "Poco/DateTimeFormatter.h"
#include "Poco/DateTimeParser.h"
#include <iostream>
using Poco::LocalDateTime;
using Poco::DateTime;
using Poco::DateTimeFormat;
using Poco::DateTimeFormatter;
using Poco::DateTimeParser;
int main(int argc, char** argv)
{
LocalDateTime now;
std::string str = DateTimeFormatter::format(now, DateTimeFormat::ISO8601_FORMAT);
DateTime dt;
int tzd;
DateTimeParser::parse(DateTimeFormat::ISO8601_FORMAT, str, dt, tzd);
dt.makeUTC(tzd);
LocalDateTime ldt(tzd, dt);
return 0;
}