[Poco] example of Poco: localdatetime

Source: Internet
Author: User
# Include ".. /tmain. HPP "Void test_datetime () {using poco: localdatetime; using poco: datetime; using poco: datetimeformat; using poco: datetimeformatter; using poco: datetimeparser; localdatetime now; // 2005-01-01t12: 00: 00 + 01: 00 // 2005-01-01t11: 00: 00 zstd: String str_iso = datetimeformatter: Format (now, datetimeformat: iso8601_format ); print_debug (str_iso); // sat, 01 Jan 2005 12:00:00 + 0100 // sat, 01 Jan 2005 11:00:00 gmtstd: String str_http = datetimeformatter: Format (now, datetimeformat :: http_format); print_debug (str_http); // The date/time format produced by the ansi c asctime () function. // sat Jan 1 12:00:00 2005std: String str_asctime = datetimeformatter: Format (now, datetimeformat: asctime_format); print_debug (str_asctime); // a simple, sortable date/time format. // 2005-01-01 12: 00: 00std: String str_simple = datetimeformatter: Format (now, datetimeformat: sortable_format); print_debug (str_simple); print_debug (now. year (); print_debug (now. month (); print_debug (now. day (); print_debug (now. dayofweek (); print_debug (now. dayofyear (); print_debug (now. julianday (); print_debug (datetimeformat: weekday_names [now. dayofweek ()]); print_debug (datetimeformat: month_names [now. month ()-1]); // parse the time format datetime DT; int TZD; datetimeparser: parse (datetimeformat: iso8601_format, str_iso, DT, TZD); DT. makeutc (TZD); localdatetime LDT (TZD, DT );}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.