Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
Console.Write(unixTimestamp);
var currentTimeUn = unixTimestamp.ToString();
string json = "{ \"Method\": \"GetShippedOrders\",\"Params\": { \"DateMin\": 1575158400, \"DateMax\": {currentTimeUn} }}";
How do I get currentTimeUn to be passed to DateMax?
Solution using String interpolation :
Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
var currentTimeUn = unixTimestamp.ToString();
string json = $"{{ \"Method\": \"GetShippedOrders\",\"Params\": {{ \"DateMin\": 1575158400, \"DateMax\": {currentTimeUn} }}}}";
Console.WriteLine(json);
Is this the solution you have been looking for?
Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
var currentTimeUn = unixTimestamp.ToString();
string json = "{ \"Method\": \"GetShippedOrders\",\"Params\": { \"DateMin\": 1575158400, \"DateMax\": {"+currentTimeUn+"} }}";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.