on 2022 Sep 14 12:36 PM
How do I convert a date into a string formatted per the computer's regional date setting? I only see how to specify explicit formats. For example, in PowerBuilder, I would specify date format string "[shortdate]". Forgive me if I'm missing something simple. Thanks!
Request clarification before answering.
The server does not automatically format dates according to the client connection's local OS settings. Generally, that is left up to the client app which can format the date itself or have the server do it using explicit formats via dateformat arguments or the DATE_FORMAT option (https://dcx.sap.com/index.html#sqla170/en/html/813a8b556ce21014958ea27cd4f0b21c.html*loio813a8b556ce...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you really need to format dates within the server (say, because there is no client app in-place) and you are using Windows as platform, you could take the (somewhat difficult) route to use a native function calling the GetDateFormatEx() WinAPI or similar functions...
Here's an article from Breck's blog with a sample using the GetOpenFileName() WinAPI - just to show the general approach.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, all. You bring up good points on the complexities. In this case, the server is Windows, and the client is a web application running in the Browser. The GetDateFormatEx() solution on the server will work out now, but maybe not in the future. Perhaps an application setting should define the date display format in this case? I'll give this some thought.
Just to clarify: You can also set options like date_order/date_format/timestamp_format per connection and can use dateformat() with the according connection properties to provide connection-specific formatting, so possibly a client app could also provide regional settings to the server via those options...
User | Count |
---|---|
74 | |
30 | |
9 | |
7 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.