27.11.2014 Views

Working with date and time, time spans, time zones as well ... - Poco

Working with date and time, time spans, time zones as well ... - Poco

Working with date and time, time spans, time zones as well ... - Poco

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

#include "<strong>Poco</strong>/DateTime.h"<br />

using <strong>Poco</strong>::DateTime;<br />

int main(int argc, char** argv)<br />

{<br />

DateTime now; // the current <strong>date</strong> <strong>and</strong> <strong>time</strong> in UTC<br />

int year = now.year();<br />

int month = now.month();<br />

int day = now.day();<br />

int dow = now.dayOfWeek();<br />

int doy = now.dayOfYear();<br />

int hour = now.hour();<br />

int hour12 = now.hourAMPM();<br />

int min = now.minute();<br />

int sec = now.second();<br />

int ms = now.millisecond();<br />

int us = now.microsecond();<br />

double jd = now.julianDay();<br />

<strong>Poco</strong>::Timestamp ts = now.<strong>time</strong>stamp();<br />

DateTime xm<strong>as</strong>(2006, 12, 25); // 2006-12-25 00:00:00<br />

<strong>Poco</strong>::Timespan <strong>time</strong>ToXm<strong>as</strong> = xm<strong>as</strong> - now;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!