I\'ve got a WebAPI action that looks like so:
[Route(\"api/values/{id}\")]
public async Task Delete(string id, DateTimeOffset date
Here is the easiest way for those who are looking for some kind of sync between client and server using datetime. I implemented that for mobile application. It is independent from the culture of the client. because my mobile app supports multiple cultures and it is boring to use formatting between those cultures. thanks that .net has a perfect functions called ToFileTime
and FromFileTime
Server Controller Action:
[HttpGet("PullAsync")]
public async Task PullSync(long? since = null, int? page = null, int? count = null)
{
if (since.HasValue)
DateTimeOffset date = DateTimeOffset.FromFileTime(since.Value);
}
Client Side
DateTimeOffset dateTime = DateTime.Now.ToFileTime();
var url= $"/PullAsync?since={datetime}&page={pageno}&count=10";