I have an api url in the following format;
https://MyAPI.com/stuff/pending_since/{{DATE-TIME}}
I've tried;
var myDate = new DateTime(2020, 1, 1);
var stringTask = client.GetStringAsync("https://MyAPI.com/stuff/pending_since/{{myDate}}");
var json = await stringTask;
Console.WriteLine(json);
That returns an error. How do I pass the date in the url? Thanks, John
myDaterather than just letting .NET use whatever the current thread's culture is to determine the format. As you can see, different cultures will have different formats. The default culture an applications starts under depends on the OS settings.https://MyAPI.com/stuff/pending_since/{{myDate}}. You're not using the value of the variable at all. I don't know whether that's because you made a mistake when creating the code for the question, or whether that's actually in the broken code you're running. This is where a minimal reproducible example would really help...