Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

DateTime.AddDays breaks on ios project

$
0
0
I am using the DateTime.AddDays function on my Unity project, built for iOS. Everything compiles fine and I can run my project through xCode. The dates that I use for my function are correct. However, when I use the "AddDays" function, I suddenly get an "Argumentoutof range" error... I don't understand what I'm doing wrong. public DateTime GetWeekStart(DateTime currTime, DayOfWeek startOfWeek) { double diff = (double)(currTime.DayOfWeek - startOfWeek); if (diff < 0) { diff += 7; } double addAmount = -1 * diff; return currTime.AddDays(addAmount); } Here is the error that I'm getting: ArgumentOutOfRangeException: Argument is out of range. at System.DateTime.AddTicks (Int64 value) [0x00000] in :0 at System.DateTime.AddMilliseconds (Double value) [0x00000] in :0 at System.DateTime.AddDays (Double value) [0x00000] in :0 at DataManager.GetWeekStart (DateTime currTime, DayOfWeek startOfWeek) [0x00000] in :0

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>