I need to convert the date format of mm-dd-yyyy to the date format of yyyy-mm-dd

I need to convert the date format of mm-dd-yyyy to the date format of yyyy-mm-dd, any good suggestions

Unfortunately your question misses a lot of important information.

What is the input data format? A string? Or a date? A lot of beginners think that a date has a particular string format assigned, which isn’t the case. If you have a date, you don’t convert from any string format - you’ll just take the date and format is required.

Another crucial piece of information is where you need to do it. You’ll use a completely different approach if you want to do it, say, in X++ code or in an SSRS report.

Then, should the date format be hard-coded or is it driven by some setup, such as user’s language or data import regional settings?

You need to think about such things before you start looking for a solution. If you know what you actually want, you’ll be able to formulate a question that you may be able to answer by searching the internet.

I want to perform such a conversion in the SSrs report, and the input data format is also date

Good, so we can completely forget the part of conversion from mm-dd-yyyy format, because it doesn’t play any role there. We just need to apply yyyy-mm-dd format to the date.

Now please answer the question about how the format is defined (the second to last paragraph).

By the way, do you want to use the same format for all dates in the report, or do you want to see dates in various formats?

data import regional settings,It should be automatically converted according to the time zone set by the current user in the system

Hmm, what does it have to do with data import settings and time zones? I thought we’re talking about date time format in SSRS reports.

It is the date and time format in the SSRS report. Isn’t this related to the time zone set by the user in the system?

No, it’s not related to the time zone. The time zone influences what time (and date) you see in GUI. For example, it’s approaximately 10 AM in my time zone, while it’s 5 PM in Tokyo. If I create a record right now, I’ll see it as created at 10 AM, while users with Tokyo’s time zone will see it as created at 5 PM (because “now” means different things depending on time zone). It’s not related to string formatting.

The format is - by default - derived language selected in user options.

Let’s test it on Organization administration > Inquiries and reports > Departments report. I open the report with en-US language, I see this date format:

If I switch to Czech (cs), the date format changes:

Just note that some reports take regional settings from other places. For example, an invoice is printed in vendor’s language, not user’s language.

How to check the date in the packing slip journal in Sales order is set according to what

You know, you would get relevant answers much sooner if you told us straight away what you actually need. I would think it’s in your own interest…

The packing slip journal is one of the reports that don’t take the settings from the current user. Ask yourself where such logic should be found. If you think about the report controller class, you’re right. Therefore open SalesPackingSlopController class and search for language.