本文整理汇总了C#中DateTimeOffset.?.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DateTimeOffset.?.ToString方法的具体用法?C# DateTimeOffset.?.ToString怎么用?C# DateTimeOffset.?.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeOffset
的用法示例。
在下文中一共展示了DateTimeOffset.?.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHistoryAsync
public static async Task<History> GetHistoryAsync(this IMarketsFeature feature, string symbol, string interval = "daily", DateTimeOffset? start = null, DateTimeOffset? end = null) {
var path = new PathString("/v1/markets/history").Add(new {
symbol = symbol,
interval = interval,
start = start?.ToString("yyyy-MM-dd"),
end = start?.ToString("yyyy-MM-dd")
});
return await feature.Client.GetAsync<History>(path);
}
示例2: WriteResponseBodyAsync
internal static Task WriteResponseBodyAsync(HttpResponse response, string uid, DateTimeOffset? datetime, TimeSpan? duration, string summary, string description, string location) {
return response.WriteAsync(
"BEGIN:VCALENDAR\r\n" +
"VERSION:2.0\r\n" +
"BEGIN:VEVENT\r\n" +
"UID:" + uid + "\r\n" +
"DTSTART:" + datetime?.ToString(DateTimeFormat) + "\r\n" +
"DTEND:" + datetime?.Add(duration ?? TimeSpan.Zero).ToString(DateTimeFormat) + "\r\n" +
"SUMMARY:" + summary + "\r\n" +
"DESCRIPTION:" + description + "\r\n" +
"LOCATION:" + location +
"END:VEVENT\r\n" +
"END:VCALENDAR\r\n");
}
示例3: GetLogEntries
private async Task GetLogEntries(DateTimeOffset? date)
{
var controller = CreateController();
var result = await controller.LogEntries(date?.ToString("yyyyMMdd"));
var actualDate = date ?? DateTimeOffset.Now.Date;
var expectedResult = TestLogEntries.Where(l => l.Date == actualDate.Date).ToList();
Assert.IsType<JsonResult<IEnumerable<LogEntryViewModel>>>(result);
var res = result as JsonResult<IEnumerable<LogEntryViewModel>>;
Assert.NotNull(res);
foreach (var r in res.Content)
{
var original = expectedResult.First(l => l.Id == r.Id);
Assert.Equal(original.Date, r.Date);
Assert.Equal(LogFormatter.FormatLogEntry(original), r.Message);
Assert.Equal(original.SourceUser, r.User);
}
}
示例4: Iso8601
/// <summary>
/// Type-safe helper method for R.Iso8601
/// </summary>
public Iso8601 Iso8601(DateTimeOffset? datetime)
{
var str = datetime?.ToString("o");
return Ast.Iso8601.FromString(str);
}
示例5: SetExpire
public override void SetExpire(DateTimeOffset? value)
{
_context.Response.Headers["Expires"] = value?.ToString("r", CultureInfo.InvariantCulture);
}