now is 03/05/24
now is
2024-03-05T10:51:22.312851400-06:00[America/Chicago]
Stephan van Hulst wrote:Okay, so you could do one of these:
now is 2024-03-05T11:40:31.940694800-06:00[America/Chicago]
Ron McLeod wrote:
For example:
now is 2024-03-05T11:40:31.940694800-06:00[America/Chicago]
Of course it is. About forty pages' worth of Javadoc, in the Formatter documentation. The other link you gave might be easier to read.Ron McLeod wrote:I'm sure this is available in the Javadocs somewhere. . . .
Mike Simmons wrote:It's not really a trick - this is the standard way to simply invoke toString() on whatever object you're passing..
You should know better than to try memorising details of the Javadocs. [Except maybe for a cert exam.] That is why the information is there behind a hyperlink.Anil Philip wrote:. . . That is really hard to memorize all the flags! . . .
Stephan van Hulst wrote:When using a format string,
now is
2024-03-05T12:29:47.674428500-06:00[America/Chicago]
Anil Philip wrote:I was wondering. It would be nice to be able to use a text-block as (or in) the format string for format() and also println().
It's not clear (to me) what you are wanting to do, but with a text block, I would do something like this:
Ron McLeod wrote:
It's not clear (to me) what you are wanting to do, but with a text block, I would do something like this:
Anil Philip wrote:
The textblock says it is time for lunch right now 2024-03-05T12:50:02.058123100-06:00[America/Chicago]
Anil Philip wrote:
Mike Simmons wrote:The problem is that you never closed the quotes after America/Chicago, and you're missing a closing parentheses as well.
Anil Philip wrote:
Ron McLeod wrote:
There is no need to use System.out.format -- the formatting is performed in the String#formatted method:
I wasn't aware of that method; tt appears to be an instance counterpart of the static String#format() method, which I have known about for ages.Ron McLeod wrote:. . . String#formatted method: . . .
I just had the craziest dream. This tiny ad was in it.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|