date format yyyy-MM-ddTHH:mm:ssZ

后端 未结 9 2270
走了就别回头了
走了就别回头了 2020-11-28 04:49

I assume this should be pretty simple, but could not get it :(. In this format Z is time zone.
T is long time pattern
How could I get a date in this format excep

9条回答
  •  无人及你
    2020-11-28 05:18

    It works fine with Salesforce REST API query datetime formats

    DateTime now = DateTime.UtcNow;
    string startDate = now.AddDays(-5).ToString("yyyy-MM-ddTHH\\:mm\\:ssZ");   
    string endDate = now.ToString("yyyy-MM-ddTHH\\:mm\\:ssZ");  
    //REST service Query 
    string salesforceUrl= https://csxx.salesforce.com//services/data/v33.0/sobjects/Account/updated/?start=" + startDate + "&end=" + endDate;
    
    // https://csxx.salesforce.com/services/data/v33.0/sobjects/Account/updated/?start=2015-03-10T15:15:57Z&end=2015-03-15T15:15:57Z
    

    It returns the results from Salesforce without any issues.

提交回复
热议问题