{"id":117,"date":"2013-08-28T14:17:57","date_gmt":"2013-08-28T12:17:57","guid":{"rendered":"http:\/\/ps.stefanrehwald.de\/?p=117"},"modified":"2013-08-29T12:01:54","modified_gmt":"2013-08-29T10:01:54","slug":"powershell-datum-formatieren","status":"publish","type":"post","link":"https:\/\/ps.stefanrehwald.de\/?p=117","title":{"rendered":"PowerShell &#8211; Datum Formatieren"},"content":{"rendered":"<p style=\"text-align: justify;\">Das Datum formatiert anzeigen lassen Dies kann mittels der Eigenschaft GetDateTimeFormats() bewerkstelligt werden. Diese\u00a0 gibt eine gro\u00dfe Liste von vordefinierten Einstellungen f\u00fcr das Datum aus.<\/p>\n<pre class=\"lang:ps decode:true crayon-selected\" title=\"Date Format Script I\">$date = date\r\n$date.GetDateTimeFormats()\r\n\r\n# Ausgabe\r\n28.08.2013\r\n28.Aug.2013\r\n28.08.13\r\n28.08.13\r\n28.8.13\r\n28.8.2013\r\n2013-08-28\r\nMittwoch, 28. August 2013\r\n28. August 2013\r\n28. Aug 2013\r\nMittwoch, 28. August 2013 13:05\r\nMittwoch, 28. August 2013 13:05\r\nMittwoch, 28. August 2013 13.05\r\nMittwoch, 28. August 2013 13.05 Uhr\r\n28. August 2013 13:05\r\n28. August 2013 13:05\r\n28. August 2013 13.05\r\n28. August 2013 13.05 Uhr\r\n28. Aug 2013 13:05\r\n28. Aug 2013 13:05\r\n28. Aug 2013 13.05\r\n28. Aug 2013 13.05 Uhr\r\nMittwoch, 28. August 2013 13:05:48\r\nMittwoch, 28. August 2013 13:05:48 Uhr\r\nMittwoch, 28. August 2013 13:05:48 Uhr\r\nMittwoch, 28. August 2013 130548\r\n28. August 2013 13:05:48\r\n28. August 2013 13:05:48 Uhr\r\n28. August 2013 13:05:48 Uhr\r\n28. August 2013 130548\r\n28. Aug 2013 13:05:48\r\n28. Aug 2013 13:05:48 Uhr\r\n28. Aug 2013 13:05:48 Uhr\r\n28. Aug 2013 130548\r\n28.08.2013 13:05\r\n28.08.2013 13:05\r\n28.08.2013 13.05\r\n28.08.2013 13.05 Uhr\r\n28.Aug.2013 13:05\r\n28.Aug.2013 13:05\r\n28.Aug.2013 13.05\r\n28.Aug.2013 13.05 Uhr\r\n28.08.13 13:05\r\n28.08.13 13:05\r\n28.08.13 13.05\r\n28.08.13 13.05 Uhr\r\n28.08.13 13:05\r\n28.08.13 13:05\r\n28.08.13 13.05\r\n28.08.13 13.05 Uhr\r\n28.8.13 13:05\r\n28.8.13 13:05\r\n28.8.13 13.05\r\n28.8.13 13.05 Uhr\r\n28.8.2013 13:05\r\n28.8.2013 13:05\r\n28.8.2013 13.05\r\n28.8.2013 13.05 Uhr\r\n2013-08-28 13:05\r\n2013-08-28 13:05\r\n2013-08-28 13.05\r\n2013-08-28 13.05 Uhr\r\n28.08.2013 13:05:48\r\n28.08.2013 13:05:48 Uhr\r\n28.08.2013 13:05:48 Uhr\r\n28.08.2013 130548\r\n28.Aug.2013 13:05:48\r\n28.Aug.2013 13:05:48 Uhr\r\n28.Aug.2013 13:05:48 Uhr\r\n28.Aug.2013 130548\r\n28.08.13 13:05:48\r\n28.08.13 13:05:48 Uhr\r\n28.08.13 13:05:48 Uhr\r\n28.08.13 130548\r\n28.08.13 13:05:48\r\n28.08.13 13:05:48 Uhr\r\n28.08.13 13:05:48 Uhr\r\n28.08.13 130548\r\n28.8.13 13:05:48\r\n28.8.13 13:05:48 Uhr\r\n28.8.13 13:05:48 Uhr\r\n28.8.13 130548\r\n28.8.2013 13:05:48\r\n28.8.2013 13:05:48 Uhr\r\n28.8.2013 13:05:48 Uhr\r\n28.8.2013 130548\r\n2013-08-28 13:05:48\r\n2013-08-28 13:05:48 Uhr\r\n2013-08-28 13:05:48 Uhr\r\n2013-08-28 130548\r\n28 August\r\n28 August\r\n2013-08-28T13:05:48.8646879+02:00\r\n2013-08-28T13:05:48.8646879+02:00\r\nWed, 28 Aug 2013 13:05:48 GMT\r\nWed, 28 Aug 2013 13:05:48 GMT\r\n2013-08-28T13:05:48\r\n13:05\r\n13:05\r\n13.05\r\n13.05 Uhr\r\n13:05:48\r\n13:05:48 Uhr\r\n13:05:48 Uhr\r\n130548\r\n2013-08-28 13:05:48Z\r\nMittwoch, 28. August 2013 11:05:48\r\nMittwoch, 28. August 2013 11:05:48 Uhr\r\nMittwoch, 28. August 2013 11:05:48 Uhr\r\nMittwoch, 28. August 2013 110548\r\n28. August 2013 11:05:48\r\n28. August 2013 11:05:48 Uhr\r\n28. August 2013 11:05:48 Uhr\r\n28. August 2013 110548\r\n28. Aug 2013 11:05:48\r\n28. Aug 2013 11:05:48 Uhr\r\n28. Aug 2013 11:05:48 Uhr\r\n28. Aug 2013 110548\r\nAugust 2013\r\nAugust 2013<\/pre>\n<p style=\"text-align: justify;\">Hat man sich f\u00fcr eine der Formatvorlagen entschieden, kann man dies \u00fcber den Arrayindex ansprechen. Doch wie ist der Index? Daf\u00fcr habe ich hier eine einfache For-Schleife gebastelt.<\/p>\n<pre class=\"lang:ps decode:true\" title=\"Date Format Script II\">$date = date\r\nfor ( $i = 0; $i -ne $date.GetDateTimeFormats().Count; $i++ ) {\"Index $($i) Format: $($date.GetDateTimeFormats()[$i])\" }\r\n\r\n# Ausgabe\r\nIndex 0 Format: 28.08.2013\r\nIndex 1 Format: 28.Aug.2013\r\nIndex 2 Format: 28.08.13\r\nIndex 3 Format: 28.08.13\r\nIndex 4 Format: 28.8.13\r\nIndex 5 Format: 28.8.2013\r\nIndex 6 Format: 2013-08-28\r\nIndex 7 Format: Mittwoch, 28. August 2013\r\nIndex 8 Format: 28. August 2013\r\nIndex 9 Format: 28. Aug 2013\r\nIndex 10 Format: Mittwoch, 28. August 2013 13:12\r\nIndex 11 Format: Mittwoch, 28. August 2013 13:12\r\nIndex 12 Format: Mittwoch, 28. August 2013 13.12\r\nIndex 13 Format: Mittwoch, 28. August 2013 13.12 Uhr\r\nIndex 14 Format: 28. August 2013 13:12\r\nIndex 15 Format: 28. August 2013 13:12\r\nIndex 16 Format: 28. August 2013 13.12\r\nIndex 17 Format: 28. August 2013 13.12 Uhr\r\nIndex 18 Format: 28. Aug 2013 13:12\r\nIndex 19 Format: 28. Aug 2013 13:12\r\nIndex 20 Format: 28. Aug 2013 13.12\r\nIndex 21 Format: 28. Aug 2013 13.12 Uhr\r\nIndex 22 Format: Mittwoch, 28. August 2013 13:12:12\r\nIndex 23 Format: Mittwoch, 28. August 2013 13:12:12 Uhr\r\nIndex 24 Format: Mittwoch, 28. August 2013 13:12:12 Uhr\r\nIndex 25 Format: Mittwoch, 28. August 2013 131212\r\nIndex 26 Format: 28. August 2013 13:12:12\r\nIndex 27 Format: 28. August 2013 13:12:12 Uhr\r\nIndex 28 Format: 28. August 2013 13:12:12 Uhr\r\nIndex 29 Format: 28. August 2013 131212\r\nIndex 30 Format: 28. Aug 2013 13:12:12\r\nIndex 31 Format: 28. Aug 2013 13:12:12 Uhr\r\nIndex 32 Format: 28. Aug 2013 13:12:12 Uhr\r\nIndex 33 Format: 28. Aug 2013 131212\r\nIndex 34 Format: 28.08.2013 13:12\r\nIndex 35 Format: 28.08.2013 13:12\r\nIndex 36 Format: 28.08.2013 13.12\r\nIndex 37 Format: 28.08.2013 13.12 Uhr\r\nIndex 38 Format: 28.Aug.2013 13:12\r\nIndex 39 Format: 28.Aug.2013 13:12\r\nIndex 40 Format: 28.Aug.2013 13.12\r\nIndex 41 Format: 28.Aug.2013 13.12 Uhr\r\nIndex 42 Format: 28.08.13 13:12\r\nIndex 43 Format: 28.08.13 13:12\r\nIndex 44 Format: 28.08.13 13.12\r\nIndex 45 Format: 28.08.13 13.12 Uhr\r\nIndex 46 Format: 28.08.13 13:12\r\nIndex 47 Format: 28.08.13 13:12\r\nIndex 48 Format: 28.08.13 13.12\r\nIndex 49 Format: 28.08.13 13.12 Uhr\r\nIndex 50 Format: 28.8.13 13:12\r\nIndex 51 Format: 28.8.13 13:12\r\nIndex 52 Format: 28.8.13 13.12\r\nIndex 53 Format: 28.8.13 13.12 Uhr\r\nIndex 54 Format: 28.8.2013 13:12\r\nIndex 55 Format: 28.8.2013 13:12\r\nIndex 56 Format: 28.8.2013 13.12\r\nIndex 57 Format: 28.8.2013 13.12 Uhr\r\nIndex 58 Format: 2013-08-28 13:12\r\nIndex 59 Format: 2013-08-28 13:12\r\nIndex 60 Format: 2013-08-28 13.12\r\nIndex 61 Format: 2013-08-28 13.12 Uhr\r\nIndex 62 Format: 28.08.2013 13:12:12\r\nIndex 63 Format: 28.08.2013 13:12:12 Uhr\r\nIndex 64 Format: 28.08.2013 13:12:12 Uhr\r\nIndex 65 Format: 28.08.2013 131212\r\nIndex 66 Format: 28.Aug.2013 13:12:12\r\nIndex 67 Format: 28.Aug.2013 13:12:12 Uhr\r\nIndex 68 Format: 28.Aug.2013 13:12:12 Uhr\r\nIndex 69 Format: 28.Aug.2013 131212\r\nIndex 70 Format: 28.08.13 13:12:12\r\nIndex 71 Format: 28.08.13 13:12:12 Uhr\r\nIndex 72 Format: 28.08.13 13:12:12 Uhr\r\nIndex 73 Format: 28.08.13 131212\r\nIndex 74 Format: 28.08.13 13:12:12\r\nIndex 75 Format: 28.08.13 13:12:12 Uhr\r\nIndex 76 Format: 28.08.13 13:12:12 Uhr\r\nIndex 77 Format: 28.08.13 131212\r\nIndex 78 Format: 28.8.13 13:12:12\r\nIndex 79 Format: 28.8.13 13:12:12 Uhr\r\nIndex 80 Format: 28.8.13 13:12:12 Uhr\r\nIndex 81 Format: 28.8.13 131212\r\nIndex 82 Format: 28.8.2013 13:12:12\r\nIndex 83 Format: 28.8.2013 13:12:12 Uhr\r\nIndex 84 Format: 28.8.2013 13:12:12 Uhr\r\nIndex 85 Format: 28.8.2013 131212\r\nIndex 86 Format: 2013-08-28 13:12:12\r\nIndex 87 Format: 2013-08-28 13:12:12 Uhr\r\nIndex 88 Format: 2013-08-28 13:12:12 Uhr\r\nIndex 89 Format: 2013-08-28 131212\r\nIndex 90 Format: 28 August\r\nIndex 91 Format: 28 August\r\nIndex 92 Format: 2013-08-28T13:12:12.8006879+02:00\r\nIndex 93 Format: 2013-08-28T13:12:12.8006879+02:00\r\nIndex 94 Format: Wed, 28 Aug 2013 13:12:12 GMT\r\nIndex 95 Format: Wed, 28 Aug 2013 13:12:12 GMT\r\nIndex 96 Format: 2013-08-28T13:12:12\r\nIndex 97 Format: 13:12\r\nIndex 98 Format: 13:12\r\nIndex 99 Format: 13.12\r\nIndex 100 Format: 13.12 Uhr\r\nIndex 101 Format: 13:12:12\r\nIndex 102 Format: 13:12:12 Uhr\r\nIndex 103 Format: 13:12:12 Uhr\r\nIndex 104 Format: 131212\r\nIndex 105 Format: 2013-08-28 13:12:12Z\r\nIndex 106 Format: Mittwoch, 28. August 2013 11:12:12\r\nIndex 107 Format: Mittwoch, 28. August 2013 11:12:12 Uhr\r\nIndex 108 Format: Mittwoch, 28. August 2013 11:12:12 Uhr\r\nIndex 109 Format: Mittwoch, 28. August 2013 111212\r\nIndex 110 Format: 28. August 2013 11:12:12\r\nIndex 111 Format: 28. August 2013 11:12:12 Uhr\r\nIndex 112 Format: 28. August 2013 11:12:12 Uhr\r\nIndex 113 Format: 28. August 2013 111212\r\nIndex 114 Format: 28. Aug 2013 11:12:12\r\nIndex 115 Format: 28. Aug 2013 11:12:12 Uhr\r\nIndex 116 Format: 28. Aug 2013 11:12:12 Uhr\r\nIndex 117 Format: 28. Aug 2013 111212\r\nIndex 118 Format: August 2013\r\nIndex 119 Format: August 2013<\/pre>\n<p>Der Arrayindex wird dann wie folgt angegeben.<\/p>\n<pre class=\"lang:ps decode:true\" title=\"Date Format Script III\">$date = date\r\n$date.GetDateTimeFormats()[22]\r\n\r\n# Ausgabe\r\nMittwoch, 28. August 2013 13:07:17<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>rewe<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Das Datum formatiert anzeigen lassen Dies kann mittels der Eigenschaft GetDateTimeFormats() bewerkstelligt werden. Diese\u00a0 gibt eine gro\u00dfe Liste von vordefinierten Einstellungen f\u00fcr das Datum aus. $date = date $date.GetDateTimeFormats() # Ausgabe 28.08.2013 28.Aug.2013 28.08.13 28.08.13 28.8.13 28.8.2013 2013-08-28 Mittwoch, 28. &hellip; <a href=\"https:\/\/ps.stefanrehwald.de\/?p=117\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":8,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,9],"tags":[164,166,165,171,172,174,173,170,168,167,169,176,177,175],"class_list":["post-117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","category-snippet","tag-arrayindex","tag-date","tag-datum","tag-datum-format","tag-datum-konvertieren","tag-format-date","tag-formatierung-datum","tag-ge-tdate-time-formats","tag-get-datum","tag-get-date","tag-getdatetimeformats","tag-time-format","tag-time-formats","tag-timeformats"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ps.stefanrehwald.de\/wp-content\/uploads\/2013\/08\/logo_powershell.jpg","jetpack_shortlink":"https:\/\/wp.me\/p3N2Ht-1T","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=117"}],"version-history":[{"count":4,"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions"}],"predecessor-version":[{"id":121,"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions\/121"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=\/wp\/v2\/media\/8"}],"wp:attachment":[{"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ps.stefanrehwald.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}