{"id":3755,"date":"2021-12-11T06:16:11","date_gmt":"2021-12-11T06:16:11","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=3755"},"modified":"2021-12-11T06:47:10","modified_gmt":"2021-12-11T06:47:10","slug":"2e-wxwidgets-date-and-time","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2021\/12\/11\/2e-wxwidgets-date-and-time\/","title":{"rendered":"2e.wxWidgets &#8211; Date and Time"},"content":{"rendered":"\n<p><strong>OVERVIEW<\/strong><\/p>\n\n\n\n<p>wxWidgets provides powerful date and time management functions like formatting time strings, handling time zones and doing time calculations.<\/p>\n\n\n\n<p><strong>SAMPLE CODE<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">datetime.cpp<\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &lt;wx\/wxprec.h&gt;\n#ifndef WX_PRECOMP\n\t#include &lt;wx\/wx.h&gt;\n#endif\n#include &lt;wx\/string.h&gt;\n#include &lt;wx\/datetime.h&gt;\n\nint main(int argc, char **argv) {\n\twxInitialize();\n\n\twxDateTime now = wxDateTime::Now();\n\twxString format1 = now.Format();\n\twxString format2 = now.Format(wxT(&quot;%x&quot;));\n\twxString format3 = now.Format(wxT(&quot;%X&quot;));\n\twxString format4 = now.Format(wxT(&quot;%A %B&quot;));\n\n\twxPuts(format1);\n\twxPuts(format2);\n\twxPuts(format3);\n\twxPuts(format4);\n\n\twxString nyc =  now.Format(wxT(&quot;%a %T&quot;), wxDateTime::EDT).c_str();\n\twxPuts(wxT(&quot;New York:&quot;) + nyc);\n\n\twxString tokyo =  now.Format(wxT(&quot;%a %T&quot;), wxDateTime::GMT9).c_str();\n\twxPuts(wxT(&quot;Tokyo:&quot;) + tokyo);\n\n\twxDateSpan span1 (0,1,0);\n\twxDateSpan span2 (1,6,0);\n\twxDateTime date1 = now.Add(span1);\n\twxPrintf(date1.Format(wxT(&quot;%B %d %Y\\n&quot;)));\n\n\twxDateTime date2 = now.Add(span2);\n\twxPrintf(date2.Format(wxT(&quot;%B %d %Y\\n&quot;)));\n\n\twxTimeSpan timespan1 (1,30,0);\n\twxDateTime time1 = wxDateTime::Now();\n\ttime1.Add(timespan1);\n\twxPrintf(time1.Format(wxT(&quot;%X\\n&quot;)));\n\n\twxUninitialize();\n}\n<\/pre><\/div>\n\n\n<p>The output is given below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Sat Dec 11 11:45:27 2021\n 12\/11\/21\n 11:45:27\n Saturday December\n New York:Sat 02:15:27\n Tokyo:Sat 15:15:27\n January 11 2022\n July 11 2023\n 13:15:27<\/pre>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>OVERVIEW wxWidgets provides powerful date and time management functions like formatting time strings, handling time zones and doing time calculations. SAMPLE CODE datetime.cpp The output <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2021\/12\/11\/2e-wxwidgets-date-and-time\/\" title=\"2e.wxWidgets &#8211; Date and Time\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":3595,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302,365],"tags":[],"class_list":["post-3755","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cc","category-wxwidgets"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=3755"}],"version-history":[{"count":3,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3755\/revisions"}],"predecessor-version":[{"id":3766,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3755\/revisions\/3766"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/3595"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=3755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=3755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=3755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}