- It is impossible. Unless you use a locale in which such a format is "preferred"; but since it is a technical format, it is not directly used in human reality. So such a locale hardly exists, since there is no region where it is relevant. But even if it existed, inside it would still be a conversion to a string. But you do not see this stage. He is inside.
- There is some misunderstanding here.
Suppose you have the string "FF" containing a hexadecimal representation of a number.
And you are trying to turn it into an integer value. You open the debugger and see with horror that the 16th is lost! Instead of the original FF, you see the decimal 255.
Panic. Perplexity
But what if I tell you that inside is not 255 at all? There is a number in the form with which your computer is more convenient to make calculations, and most likely it is in binary form: 0...0 1111 1111 .
That's just to bring you these bytes directly - a bad idea. First, it is a feature of the computer that you are currently using. Secondly, where and how to display? In the text box? They need a string consisting of characters. But you do not have them yet, only bare bytes. Displaying them directly is dangerous - in the used encoding of printable characters with such codes it may not be at all.
Therefore, when outputting to any text space, debuggers and many other means display values in those representations in which these values are clearer to you . For numbers, these are sequences of Arabic decimal digits. So historically, this format is understandable to almost the whole world.
Therefore, if you need to display a number in hexadecimal form, you will have to convert it to a string yourself , indicating the base of the number system .
Same with DateTime . Yes, he loses the format! And inside it keeps the date in such a crazy way that at first human sight it will not even be obvious that this is a moment in time. And it will be transformed into a string for output without other explicit instructions in the form that, according to the system prompt (locale), will be most understandable to you.
If you need to display the date in ISO8601, then (as above) you will have to explicitly convert it to a string indicating the format .
So it goes.