cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ToText default format for DateTime values

afanofosc
Discoverer
0 Likes
1,236

I have a formula displayed in the top right corner of many reports called CurrentDateTimeString. The formula is ToText(CurrentDateTime). What I want to know is exactly what Windows OS regional settings are being used by Crystal to convert that DateTime to a string when no format is specified in the ToText function. Is this documented anywhere?

View Entire Topic
DellSC
Active Contributor
0 Likes

I believe it will use whatever the Windows Default format is for the computer where it's being run.

-Dell

afanofosc
Discoverer
0 Likes

That is definitely not what Crystal does. There is no "Windows Default format" for a combined Date and Time value. In C# there is a "standard format" called "G" which is not defined at the OS level. For C# that means "short date plus a space plus long time" but in our software prior to running a Crystal report using the .Net C# classes provided by Crystal if I change the current thread CultureInfo DateTimeFormatInfo object's ShortDatePattern and its LongTimePattern Crystal is ignoring those changes when it outputs a full DateTime value using ToText in a report but it is using the ShortDatePattern when it formats a Date field on the same report. The ToText(CurrentDateTime) field is set to "use default" formatting, i.e., not custom field formatting. The same is true for the Date fields. But nothing I have tried is able to convince Crystal to use the custom ShortDatePattern and LongTimePattern values that I have specified for the current thread when it outputs a DateTime value using the ToText function with no format specified.