I have a big list of different DateTime field. Then need converting date by specified range, for instance (this condition):
var startDate = new DateTime(2021, 2, 1, 0, 00, 00, DateTimeKind.Utc);
var endDate = new DateTime(2021, 5, 1, 0, 0, 00, DateTimeKind.Utc);
Then I added offset to my dateTime
...
var offset = dateTime!.Value.Subtract(firstCandleTimestamp);
return candles.Select(mc => { mc.Timestamp = mc.Timestamp.Add(offset); return mc; });
...
But i have some important property periodSeond to that convert my date. For example i converting my date to range by condition upper
- {Timestamp: 01/02/2021 12:00:00 am}
- {Timestamp: 01/02/2021 1:00:00 am}
- {Timestamp: 01/02/2021 2:00:00 am}
But I need change my date and return by period. For exmaple periodSecond = 180 sec (= 3min)
- {Timestamp: 01/02/2021 12:03:00 am}
- {Timestamp: 01/02/2021 1:06:00 am}
- {Timestamp: 01/02/2021 2:09:00 am}
or periodSeond = 86400( = 1day)
- {Timestamp: 01/02/2021 00:00:00 am}
- {Timestamp: 02/02/2021 00:00:00 am}
- {Timestamp: 03/02/2021 00:00:00 am}
etc... Need change datetime by this scenario.