I was wanting to come up with my own sqldate for the new framework date and came up with:
Function sqldate(extends d as xojo.core.date) As text
return d.totext(xojo.core.locale.raw, xojo.core.date.FormatStyles.Medium, xojo.core.date.FormatStyles.none)
End Function
It works, but returns the time. I can filter that out but I thought it was odd so I searched around and found this discussion. They found the same thing with the time, but they were talking about a nil locale. That made it sound like behind the scenes, a nil locale is actually xojo.core.locale.raw. Since I’m a fan of less typing I substituted nil for the locale in my function:
Function sqldate(extends d as xojo.core.date) As text
return d.totext(nil, xojo.core.date.FormatStyles.Medium, xojo.core.date.FormatStyles.none)
End Function
This doesn’t work and gives an interesting error:
[code]xojo.Core.InvalidArgumentException
The Raw locale only accepts the Medium Date/Time format styles[/code]
Raw locale? I entered nil, not Raw. So that also sounds like nil = xojo.core.locale.raw. But if you explicitly tell it to use Raw, it works, despite what the exception with nil says.