digitalmars.D.learn - Formated Output and file creation time
- Vino.B (19/19) Aug 16 2017 Hi,
- H. S. Teoh via Digitalmars-d-learn (7/22) Aug 16 2017 Try this:
- Vino.B (3/9) Aug 18 2017 Hi Teoh,
Hi, I have a small program which will list the file names, size and creation date and time, the output of the program is as below and required your help to print the output as per "Required Output" Current Output C:\Test1\Test2\TXXXXXXXXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54.0618385 C:\Test1\Test2\TXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54.0618385 C:\Test1\Test2\TXXX.txt 1234 2017-Aug-16 19:10:54.0618385 Required Output (1) Alain in Table Format like below (2) Remove the msec from the date part (0618385) C:\Test1\Test2\TXXXXXXXXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54 C:\Test1\Test2\TXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54 C:\Test1\Test2\TXXX.txt 1234 2017-Aug-16 19:10:54 I tried the below but no luck writefln("%s %10d %10s", d, d.size, d.timeCreated()); From, Vino.B
Aug 16 2017
On Wed, Aug 16, 2017 at 03:30:18PM +0000, Vino.B via Digitalmars-d-learn wrote: [...]Current Output C:\Test1\Test2\TXXXXXXXXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54.0618385 C:\Test1\Test2\TXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54.0618385 C:\Test1\Test2\TXXX.txt 1234 2017-Aug-16 19:10:54.0618385 Required Output (1) Alain in Table Format like below (2) Remove the msec from the date part (0618385) C:\Test1\Test2\TXXXXXXXXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54 C:\Test1\Test2\TXXXXXXXXX.txt 1234 2017-Aug-16 19:10:54 C:\Test1\Test2\TXXX.txt 1234 2017-Aug-16 19:10:54 I tried the below but no luck writefln("%s %10d %10s", d, d.size, d.timeCreated());Try this: writefln("%-36s %8s %.20s", d, d.size, d.timeCreated()); T -- "You know, maybe we don't *need* enemies." "Yeah, best friends are about all I can take." -- Calvin & Hobbes
Aug 16 2017
On Wednesday, 16 August 2017 at 17:03:51 UTC, H. S. Teoh wrote:On Wed, Aug 16, 2017 at 03:30:18PM +0000, Vino.B via Digitalmars-d-learn wrote: [...]Hi Teoh, Thank you very much, it worked.[...]Try this: writefln("%-36s %8s %.20s", d, d.size, d.timeCreated()); T
Aug 18 2017