当前位置: 首页>>代码示例>>C#>>正文


C# DateTimeOffset.?.ToString方法代码示例

本文整理汇总了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);
        }
开发者ID:migrap,项目名称:Tradier,代码行数:10,代码来源:MarketsFeatureExtensions.cs

示例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");
 }
开发者ID:migrap,项目名称:Migrap.AspNet.Mvc.Formatters.iCalendar,代码行数:14,代码来源:iCalendarOutputFormatter.cs

示例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);
            }
        }
开发者ID:trichards57,项目名称:new-bike-tracker,代码行数:23,代码来源:ReportControllerTests.cs

示例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);
 }
开发者ID:fjsnogueira,项目名称:RethinkDb.Driver,代码行数:8,代码来源:TopLevel.cs

示例5: SetExpire

 public override void SetExpire(DateTimeOffset? value)
 {
     _context.Response.Headers["Expires"] = value?.ToString("r", CultureInfo.InvariantCulture);
 }
开发者ID:harriyott,项目名称:Hangfire,代码行数:4,代码来源:AspNetCoreDashboardResponse.cs


注:本文中的DateTimeOffset.?.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。