Date formatting Xojo.Core

I can’t get the date in this format “10-9-2015” which was the format of the old .Shortdate format. If I use

bDate.ToText(Locale.Current, Date.FormatStyles.Short, Date.FormatStyles.None)

I get “10-9-15” while

bDate.ToText(Locale.Current, Date.FormatStyles.Long, Date.FormatStyles.None)

gives “11 september 2015”.

How to solve this?

If you need output different from any of the Xojo.Core.Data.FormatStyles then you’ll have to make it yourself:

Dim shortDate As Text shortDate = bDate.Day.ToText + "-" + bDate.Month.ToText + "-" + bDate.Year.ToText

Hi Paul,

I reckoned the answer would be like this. Thanks.

Xojo.core.date.format will respect your local settings.
If you change local short to full year you will get it.

Otherwise you have to rebuild the format as Paul’s tip.

Actually that was the System specified short date format which could vary from user to user & locale to locale