garrus_j
garrus_j
CC#
Created by garrus_j on 1/18/2023 in #help
❔ DateTime help with NodaTime
Because I want the end of every hourly period to be a full datetime object in the database. I don't know why the api doesnt just deliver it that way
9 replies
CC#
Created by garrus_j on 1/18/2023 in #help
❔ DateTime help with NodaTime
It is a full DateTime object, which is the Date in the json plus the second hour of the timespan joined together. So 2022-10-30T00:00:00 plus 01:00 would be the first item, or 2022-10-30T01:00:00
9 replies
CC#
Created by garrus_j on 1/18/2023 in #help
❔ DateTime help with NodaTime
thats what I've got so far, it works, but obviously it can't differentiate the first and second instance of 2am on that date
9 replies
CC#
Created by garrus_j on 1/18/2023 in #help
❔ DateTime help with NodaTime
public static DateTimeOffset ConvertCETToUTC(this DateTime cetTime) { // var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"); // // bool isDST = dateTimeCET.IsDaylightSavingTime(); // DateTimeOffset dateTimeOffsetUTC = TimeZoneInfo.ConvertTimeToUtc(dateTimeCET, timeZoneInfo); var cetInstant = Instant.FromDateTimeUtc(cetTime.ToUniversalTime()); var cetZone = DateTimeZoneProviders.Tzdb["Europe/Berlin"]; var cetZoned = new ZonedDateTime(cetInstant, cetZone); var utcZoned = cetZoned.ToInstant().InUtc(); DateTime utcTime = utcZoned.ToDateTimeUtc(); return utcTime; }
9 replies
CC#
Created by garrus_j on 11/29/2022 in #help
❔ Ugly foreach - can it be improved?
Thanks, it looks cleaner in LINQ to me. I don't think performance has much to say as it's a worker that runs a task a few times a day and just stores the prices
34 replies
CC#
Created by garrus_j on 11/29/2022 in #help
❔ Ugly foreach - can it be improved?
ahh perfect
34 replies
CC#
Created by garrus_j on 11/29/2022 in #help
❔ Ugly foreach - can it be improved?
a site that generates a "nice" looking code snippet haha
34 replies
CC#
Created by garrus_j on 11/29/2022 in #help
❔ Ugly foreach - can it be improved?
definitely not my ide haha
34 replies
CC#
Created by garrus_j on 11/29/2022 in #help
❔ Ugly foreach - can it be improved?
it was the default on ray.so
34 replies
CC#
Created by garrus_j on 11/29/2022 in #help
❔ Ugly foreach - can it be improved?
Alright, LINQ here i come. Thanks!
34 replies