{"id":149,"date":"2018-02-21T11:37:54","date_gmt":"2018-02-21T11:37:54","guid":{"rendered":"http:\/\/basicwebsitesolutions.com\/blog\/?p=149"},"modified":"2018-02-21T11:37:54","modified_gmt":"2018-02-21T11:37:54","slug":"delphi-date-and-time-format-from-ddd-mm-yy-to-mm-dd-yyyy","status":"publish","type":"post","link":"https:\/\/basicwebsitesolutions.com\/blog\/2018\/02\/21\/delphi-date-and-time-format-from-ddd-mm-yy-to-mm-dd-yyyy\/","title":{"rendered":"Delphi : Date and Time Format from ddd-mm-yy to mm\/dd\/yyyy"},"content":{"rendered":"<p>i had a case a few weeks back of a problem where the computer needs to have a date format of dd-mmm-yy which in today&#8217;s date is 21-Feb-18. What i need is for the program to act the same as it was with the format 02\/21\/2018.<\/p>\n<p>After digging data, i came across these gems of a find. It&#8217;s so short and so obvious, i hope this code can help somebody out<\/p>\n<p>Enjoy<\/p>\n<p>Coffee Cup<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>{<br \/>\nCurrencyString, CurrencyFormat, NegCurrFormat, ThousandSeparator,<br \/>\nDecimalSeparator, CurrencyDecimals, DateSeparator, ShortDateFormat,<br \/>\nLongDateFormat, TimeSeparator, TimeAMString, TimePMString,<br \/>\nShortTimeFormat, LongTimeFormat<\/p>\n<p>\/\/Change COMPUTER date and time<br \/>\nSetLocaleInfo(GetThreadLocale, LOCALE_SSHORTDATE, &#8216;MM\/dd\/yyyy&#8217;);<br \/>\nSendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0,<br \/>\nSMTO_ABORTIFHUNG, 1000, PDWord(Nil)^);<\/p>\n<p>\/\/Change formatting from within the APPLICATION<br \/>\nDateSeparator := &#8216;\/&#8217;;<br \/>\nShortDateFormat := &#8216;MM\/dd\/yyyy&#8217;;<\/p>\n<p>SetLocaleInfo(DefaultLCID, LOCALE_SSHORTDATE, &#8216;m\/d\/yy&#8217;) (short form) and<br \/>\nSetLocaleInfo(DefaultLCID, LOCALE_SLONGDATE, &#8216;mmmm d, yyyy&#8217;) (long form)<\/p>\n<p>SetLocaleInfo(GetThreadLocale, LOCALE_SSHORTDATE, &#8216;MM\/dd\/yyyy&#8217;);<br \/>\nSendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0,<br \/>\nSMTO_ABORTIFHUNG, 1000, PDWord(Nil)^);<br \/>\n}<\/p>\n<p>\/\/ Change the display formatting<br \/>\nDateSeparator := &#8216;\/&#8217;;<br \/>\nShortDateFormat := &#8216;MM\/dd\/yyyy&#8217;;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>i had a case a few weeks back of a problem where the computer needs to have a date format of dd-mmm-yy which in today&#8217;s date is 21-Feb-18. What i need is for the program to act the same as it was with the format 02\/21\/2018. After digging data, i came across these gems of &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/basicwebsitesolutions.com\/blog\/2018\/02\/21\/delphi-date-and-time-format-from-ddd-mm-yy-to-mm-dd-yyyy\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Delphi : Date and Time Format from ddd-mm-yy to mm\/dd\/yyyy&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1,2],"tags":[74,36,75],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-day-to-day-life","category-life-as-a-programmer","category-windows-and-beyond","tag-date-and-time","tag-delphi","tag-shortdateformat"],"_links":{"self":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":1,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions\/150"}],"wp:attachment":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}