On Saturday, 4 November 2023 at 18:11:53 UTC, Vahid wrote:
Hi,

I have a date string with the format of "2023-11-04 23:10:20". I want to convert this string to Date object and also, add ±N hours to it. For example:

`"2023-11-04 23:10:20" + "+2:00" = "2023-11-05 01:10:20"`
`"2023-11-04 23:10:20" + "-2:30" = "2023-11-05 20:40:20"`

How can I do this?

Parse the date. There is a nice package on code.dlang.org that is for date parsing: https://code.dlang.org/packages/dateparser

-Steve

Reply via email to