Add a duration (in Days) to a Date

2019-11-13 Thread Mil58 via Digitalmars-d-learn
Hi all... In the following example, i would to add the "diff" value (in days) to a certain date (or the today's date "auj") >> import std.stdio; import std.datetime; import core.time : Duration; void main() { auto deb = DateTime(2019, 9, 5); auto auj = Clock.currTime(); writeln("Aujourd'

Re: Remove unwanted ' \r ' from an Array ... by reading a *.txt file.

2019-10-24 Thread Mil58 via Digitalmars-d-learn
On Thursday, 24 October 2019 at 16:21:47 UTC, welkam wrote: On Thursday, 24 October 2019 at 15:27:05 UTC, Mil58 wrote: [...] void main() { File("data.txt", "r+") .byLineCopy() .array() .each!writeln; } byLineCopy removes the new lines. If in the future you would n

Remove unwanted ' \r ' from an Array ... by reading a *.txt file.

2019-10-24 Thread Mil58 via Digitalmars-d-learn
Hi all It's me again ;-) (because you're very strong in Dlang, here...) In want a result as i write in a comment, with remove unwanted '\r' >> import std.stdio; import std.file; import std.conv; import std.process : executeShell; /* Content of 'values.txt' >> abcd 1234 03b52h */ void

Re: Differences between two dates (in days...)

2019-10-24 Thread Mil58 via Digitalmars-d-learn
On Thursday, 24 October 2019 at 12:01:21 UTC, Adam D. Ruppe wrote: On Thursday, 24 October 2019 at 11:50:04 UTC, Mil58 wrote: [...] Try this: Duration diff = cast(DateTime) auj - deb; writeln("Diff : ", diff.total!"days"); [...] Awsome ! Thank you for your quick reply... Both lines work pe

Differences between two dates (in days...)

2019-10-24 Thread Mil58 via Digitalmars-d-learn
Hi All... I am desperate for the answer to the following problem: to obtain the difference between the date of today and an older date (results in days...) See my script below, where I would like to do: "date of today" (var: auj) - "an older date" (var: deb) = xx days import std.stdio; import

Re: several types in one Array ?

2019-10-17 Thread Mil58 via Digitalmars-d-learn
On Thursday, 17 October 2019 at 14:50:23 UTC, Paul Backus wrote: On Thursday, 17 October 2019 at 14:45:24 UTC, Mil58 wrote: Hi all... Does exist (or not?) a way to create array with several types (as in Python) (example) : xxx[4] myTab = [180, "John", false, -0.771]; Of course, this is doi

several types in one Array ?

2019-10-17 Thread Mil58 via Digitalmars-d-learn
Hi all... Does exist (or not?) a way to create array with several types (as in Python) (example) : xxx[4] myTab = [180, "John", false, -0.771]; Of course, this is doing an Error ;-) Thanks.