Date Formating

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Dec 13 01:54:03 UTC 2017


On Tuesday, December 12, 2017 15:56:59 Vino via Digitalmars-d-learn wrote:
> Hi All,
>
>    Request out help on date formatting, I have code which output
> the date and time as below , i we need it without the last few
> numbers.,ie "YYYY-MMM-DD HH:MM:SI"
>
> Output : 2017-Sep-06 16:06:42.7223837
> Required Output : 2017-Sep-06 16:06:42

If you want to strip off the fractional seconds, then just zero them out.
e.g.

sysTime.fracSecs = Duration.zero;

The to*String functions of SysTime don't display trailing zeroes and don't
display the decimal point if the fractional seconds are zero.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list