digitalmars.D.learn - Formatted date
- Alexander Zhirov (10/10) Mar 22 2023 Tell me, how can I use such a date conversion mechanism? I didn't
- Anonymouse (14/16) Mar 22 2023 Maybe there's a better way but I just do this.
- Anonymouse (4/8) Mar 22 2023 I missed the part about receiving the time, so ignore my previous
- Steven Schveighoffer (6/19) Mar 22 2023 D's datetime intentionally does not tackle formatting -- it's a huge
- Alexander Zhirov (3/8) Mar 22 2023 I'll try it tomorrow, thanks!
Tell me, how can I use such a date conversion mechanism? I didn't find [something](https://www.php.net/manual/en/datetime.format.php) similar on the forum. Convert date from received time ``` Clock.currTime().toSimpleString() ``` So that i can get a more readable look: `2023-Mar-22 16:53:42.2507395` => `2023.03.22 16:53:42`
Mar 22 2023
On Wednesday, 22 March 2023 at 14:02:53 UTC, Alexander Zhirov wrote:So that i can get a more readable look: `2023-Mar-22 16:53:42.2507395` => `2023.03.22 16:53:42`Maybe there's a better way but I just do this. ``` import std; void main() { const now = Clock.currTime(); enum pattern = "%d.%02d.%02d %02d:%02d:%02d"; writefln(pattern, now.year, now.month, now.day, now.hour, now.minute, now.second); } ``` https://run.dlang.io/is/mhvzN2
Mar 22 2023
On Wednesday, 22 March 2023 at 14:02:53 UTC, Alexander Zhirov wrote:Convert date from received time ``` Clock.currTime().toSimpleString() ```I missed the part about receiving the time, so ignore my previous post.
Mar 22 2023
On 3/22/23 10:02 AM, Alexander Zhirov wrote:Tell me, how can I use such a date conversion mechanism? I didn't find [something](https://www.php.net/manual/en/datetime.format.php) similar on the forum. Convert date from received time ``` Clock.currTime().toSimpleString() ``` So that i can get a more readable look: `2023-Mar-22 16:53:42.2507395` => `2023.03.22 16:53:42`D's datetime intentionally does not tackle formatting -- it's a huge undertaking. There is an option on code.dlang.org: https://code.dlang.org/packages/datefmt -Steve
Mar 22 2023
On Wednesday, 22 March 2023 at 17:53:39 UTC, Steven Schveighoffer wrote:D's datetime intentionally does not tackle formatting -- it's a huge undertaking. There is an option on code.dlang.org: https://code.dlang.org/packages/datefmt -SteveI'll try it tomorrow, thanks!
Mar 22 2023