Hi,
In my applications that I've build so far in my training, i've struggle finding a way to change the format of dates shown in my pages. At the moment it's like this:
mm/dd/yyyy
But what I want is this:
dd-mm-yyyy
What is the proper way to achieve this?
Show date fields with another format
By default, the date-format is related to the chosen user language, the GUI starts up in. So for (US) English, the default format would be mm/dd/yyyy. It is possible to override this within the extended properties of the Runtime Configuration. Set the property customdatemask to dd-MM-yyyy for your required date format.
Within reports (for instance Crystal Reports) there are also settings to change the date format to any given format, but I usually prefer to let SQL server handle date formatting for me using the CONVERT function. For more information on the CONVERT function, please look at the Microsoft documentation: https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-2017
Within reports (for instance Crystal Reports) there are also settings to change the date format to any given format, but I usually prefer to let SQL server handle date formatting for me using the CONVERT function. For more information on the CONVERT function, please look at the Microsoft documentation: https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-2017
There is also an extended property UseWindowsCulture available. Set this property to 'true' to use the Windows Region settings for dates, times and numbers instead of the default settings derived from the Thinkwise application language ID.
Note that the region settings for the application language are used, not the current Windows language.
Note that the region settings for the application language are used, not the current Windows language.
Thank you for your reply. What type of function in SF do you advice to use a convert statement in?
I'd create a function within SF that handles date-to-string formatting, in order to have one point of reference.
The function would be something like this:
The function would be something like this:
code:
--create function
create or alter function dbo.convert_date_to_string (@date datetime2)
returns varchar(100)
as
begin
return (select convert(varchar, @date, 105)) --105 = dd-mm-yyyy
end
go
--test function
select dbo.convert_date_to_string(getdate())
I was just trying this and it doesn’t seem to work in the universal interface.
I added the setting “customdatemask” with “dd-MM-yyyy” as value and that doesn’t seem to work.
Is there another way to do this?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.