# DateTime.ToString giving incorrect result

**URL:** <https://forum.xojo.com/t/datetime-tostring-giving-incorrect-result/50586>\
**Category:** General\
**Created:** [October 11, 2019, 1:55pm UTC](https://forum.xojo.com/t/datetime-tostring-giving-incorrect-result/50586 "2019-10-11T13:55:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [October 11, 2019, 1:55pm UTC](https://forum.xojo.com/t/datetime-tostring-giving-incorrect-result/50586/1 "2019-10-11T13:55:13Z")

</div>

I think the new DateTime.ToString is giving incorrect result on Windows

Dim d as Date = new Date

MessageBox d.ShortDate // Gives 10/11/2019 - Correct

Dim d2 as DateTime = DateTime.Now

MessageBox d2.ToString(Locale.Current, DateTime.FormatStyles.Short, DateTime.FormatStyles.None) // Gives 10/11/19 - Incorrect

My system short date format in control panel on the Windows is: M/d/yyyy

Edit: Tossed in bug report also: 57837 - DateTime.ToString gives incorrect result

---

<div class="post-metadata">

**Author:** ![Ulrich\_Bogun](https://forum.xojo.com/user_avatar/forum.xojo.com/ulrich_bogun/32/1864_2.png) [@Ulrich\_Bogun](https://forum.xojo.com/u/Ulrich_Bogun)\
**Post date:** [January 27, 2021, 10:24am UTC](https://forum.xojo.com/t/datetime-tostring-giving-incorrect-result/50586/2 "2021-01-27T10:24:25Z")

</div>

Just ran into this myself with 2020r2.1, but on a Mac.  
I am using German locale and DateTime.FormatStyles.Medium and got this result

![grafik](https://forum.xojo.com/uploads/default/original/2X/1/1f7aa1edf330e82573b3354fca871b9780e91e52.png)

With FormatStyles.Medium, I get at least 2 digits for the year but never the full year, except with Long and Full which are too verbose.  
By system settings, output should be ok.

 ![grafik](https://forum.xojo.com/uploads/default/original/2X/b/ba4c2deb89d62aedff49809ac9778b91a1cb7c5e.png)

Time to move this to the ignored tickets thread, I guess.

---

<div class="post-metadata">

**Author:** ![Jeannot\_Muller](https://forum.xojo.com/user_avatar/forum.xojo.com/jeannot_muller/32/13359_2.png) [@Jeannot\_Muller](https://forum.xojo.com/u/Jeannot_Muller)\
**Post date:** [February 2, 2021, 5:54am UTC](https://forum.xojo.com/t/datetime-tostring-giving-incorrect-result/50586/3 "2021-02-02T05:54:56Z")

</div>

> [@Ulrich\_Bogun](#):
>
> Time to move this to the ignored tickets thread, I guess.

Unfortunately, I gave up on the localization issue and I am building them on my own.
