I'm not sure why you are saying it returning 13 is correct for your linux machine? Is the DateTime on that machine set correctly? It should be -46. It should be 13 after reading the comment, I read it in the wrong date format culture.
Lets define your two dates (using the datetime from my response) as
- Start = 08/22/2023 11:00:00
- End = 10/08/2023 06:00:00
You are subtracting a previous date from a future date so you will end up with a negative value. You can run this code or do a fiddle to see the output.
var now = DateTime.Parse("08/22/2023 11:00:00");
var future = DateTime.Parse("10/08/2023 06:00:00");
var difference = now - future;
Console.WriteLine(difference.TotalDays);
EDIT: I read the date in US format, I didn't see the comment specifying he is targeting August 10th, not October 8th. In this case you will need to specify the format that you are providing to DateTime, I'm guessing that on your local machine (Linux Home Machine) it handles the date time parsing in that specific format you specified but when you put it on the cloud (Linux VM on GCP) its in another format.
You can use DateTime.ParseExact() to specify the format, this below code generates the correct difference.
var now = DateTime.ParseExact("22/08/2023 11:00:00", "dd/MM/yyyy hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
var futureExact = DateTime.ParseExact("10/08/2023 06:00:00", "dd/MM/yyyy hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
var differenceExact = now - futureExact;
Console.WriteLine(differenceExact.TotalDays);
Console.WriteLine("Rounded: " + Math.Round(differenceExact.TotalDays));
This will return 12.208 which you can round however you like