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


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

本文整理汇总了C#中System.DateTime.?.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.?.ToString方法的具体用法?C# DateTime.?.ToString怎么用?C# DateTime.?.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.DateTime的用法示例。


在下文中一共展示了DateTime.?.ToString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Schedule

        public ActionResult Schedule(DateTime? date, ScheduleEditModel model)
        {
            var modelsForUpdate = model.Buckets
                                       .SelectMany(b => b.Games.Where(g => g.HomeParticipant != null &&
                                                                           g.RoadParticipant != null &&
                                                                           (g.HomeParticipant.RunsScored != 0 || g.RoadParticipant.RunsScored != 0)))
                                       .ToList();

            var gameIds = modelsForUpdate.Select(g => g.GameId)
                                         .ToArray();

            var toUpdate = DbContext.Games
                                    .Where(g => gameIds.Contains(g.GameId))
                                    .ToList()
                                    .Join(modelsForUpdate, g => g.GameId, m => m.GameId, (g, m) => new {Game = g, Model = m});

            foreach (var row in toUpdate)
            {
                row.Game.GameStatusId = GameStatus.Final;
                row.Game.RoadParticipant.RunsScored = row.Model.RoadParticipant.RunsScored;
                row.Game.HomeParticipant.RunsScored = row.Model.HomeParticipant.RunsScored;
                row.Game.IsFinalized = true;
                row.Game.AddResultReportFromLeague();
            }
            DbContext.SaveChanges(User.Identity.GetUserId());

            return RedirectToAction("Schedule", new { date = date?.ToString(Consts.DateFormat) });
        }
开发者ID:jfren484,项目名称:Tcbcsl,代码行数:28,代码来源:ScheduleController.cs

示例2: SendTemplateAsync

        public Task<IList<MandrillSendMessageResponse>> SendTemplateAsync(MandrillMessage message, string templateName,
            IList<MandrillTemplateContent> templateContent = null, bool async = false,
            string ipPool = null, DateTime? sendAtUtc = null)
        {
            if (message == null) throw new ArgumentNullException(nameof(message));
            if (templateName == null) throw new ArgumentNullException(nameof(templateName));

            if (sendAtUtc != null && sendAtUtc.Value.Kind != DateTimeKind.Utc)
            {
                throw new ArgumentException("date must be in utc", nameof(sendAtUtc));
            }

            return
                MandrillApi.PostAsync<MandrillSendMessageRequest, IList<MandrillSendMessageResponse>>(
                    "messages/send-template.json",
                    new MandrillSendTemplateRequest
                    {
                        Message = message,
                        TemplateName = templateName,
                        TemplateContent = templateContent?.ToList(),
                        Async = async,
                        IpPool = ipPool,
                        SendAt = sendAtUtc?.ToString(SendAtDateFormat)
                    });
        }
开发者ID:ChrisEby,项目名称:Mandrill.net,代码行数:25,代码来源:MandrillMessagesApi.cs

示例3: Get

 /// <summary>
 /// Returns statistics of a community or an application.
 /// </summary>
 /// <param name="groupId">Community ID. </param>
 /// <param name="appId">Application ID. </param>
 /// <param name="dateFrom">Latest date of statistics to return.</param>
 /// <param name="dateTo">End date of statistics to return.</param>
 /// <returns>Returns a <see cref="List{T}"/> of <see cref="Period"/> objects.</returns>
 public async Task<Response<List<Period>>> Get(int? groupId = null, int? appId = null, DateTime? dateFrom = null,
     DateTime? dateTo = null) => await Request<List<Period>>("get", new MethodParams
     {
         {"group_id", groupId},
         {"app_id", appId},
         {"date_from", dateFrom?.ToString("yyyy-MM-dd")},
         {"date_to", dateTo?.ToString("yyyy-MM-dd")}
     });
开发者ID:RomanGL,项目名称:InTouch,代码行数:16,代码来源:StatsMethods.cs

示例4: Schedule

        public ActionResult Schedule(DateTime? date)
        {
            var model = _scheduleService.GetScheduleModelForDate(date);

            if (model == null)
            {
                return HttpNotFound($"No games found for {date?.ToString(Consts.DateFormatDisplay)}.");
            }

            return View(model);
        }
开发者ID:jfren484,项目名称:Tcbcsl,代码行数:11,代码来源:ScheduleController.cs

示例5: GetEventAnalyticsTimelineAsync

		public async Task<AnalyticsTimelineResponse> GetEventAnalyticsTimelineAsync(bool distinct = false, AnalyticsTimelineGroup group = AnalyticsTimelineGroup.Day, DateTime? from = default(DateTime?), DateTime? to = default(DateTime?), string userId = null, string name = null)
		{
			var additionalParams = new Dictionary<string, string>();
			additionalParams.Add(nameof(distinct), distinct.ToString().ToLowerInvariant());
			additionalParams.Add(nameof(group), group.ToString().ToLowerInvariant());
			if (from != null) additionalParams.Add(nameof(from), $"{from?.ToString("yyyy-MM-ddTHH:mm:ss.fff")}Z");
			if (to != null) additionalParams.Add(nameof(to), $"{to?.ToString("yyyy-MM-ddTHH:mm:ss.fff")}Z");
			if (userId != null) additionalParams.Add("user_id", userId);
			if (name != null) additionalParams.Add(nameof(name), name);

			return await HttpConnection.GetAsync<AnalyticsTimelineResponse>("/analytics/events/timeline", additionalParams);
		}
开发者ID:0xdeafcafe,项目名称:luno-dotnet,代码行数:12,代码来源:AnalyticsClient.cs

示例6: ActivityAsync

 public async Task<MandrillExportInfo> ActivityAsync(string notifyEmail,
     DateTime? dateFrom = null, 
     DateTime? dateTo = null,
     IList<string> tags = null, 
     IList<string> senders = null,
     IList<string> states = null,
     IList<string> apiKeys = null)
 {
     return await MandrillApi.PostAsync<MandrillExportRequest, MandrillExportInfo>("exports/activity",
         new MandrillExportRequest
         {   
             NotifyEmail = notifyEmail,
             DateFrom = dateFrom?.ToString(ActivityDateFormat),
             DateTo = dateTo?.ToString(ActivityDateFormat),
             Tags = tags?.ToList(),
             Senders = senders?.ToList(),
             States = states?.ToList(),
             ApiKeys = apiKeys?.ToList()
         });
 }
开发者ID:Malkiat-Singh,项目名称:Mandrill.net,代码行数:20,代码来源:MandrillExportsApi.cs

示例7: SendRawAsync

 public Task<IList<MandrillSendMessageResponse>> SendRawAsync(string rawMessage, string fromEmail = null,
     string fromName = null, IList<string> to = null, bool? async = null,
     string ipPool = null, DateTime? sendAtUtc = null, string returnPathDomain = null)
 {
     if (rawMessage == null) throw new ArgumentNullException(nameof(rawMessage));
     return
         MandrillApi.PostAsync<MandrillSendRawMessageRequest, IList<MandrillSendMessageResponse>>(
             "messages/send-raw.json",
             new MandrillSendRawMessageRequest
             {
                 RawMessage = rawMessage,
                 FromEmail = fromEmail,
                 FromName = fromName,
                 To = to?.ToList(),
                 Async = async,
                 IpPool = ipPool,
                 SendAt = sendAtUtc?.ToString(SendAtDateFormat),
                 ReturnPathDomain = returnPathDomain
             });
 }
开发者ID:ChrisEby,项目名称:Mandrill.net,代码行数:20,代码来源:MandrillMessagesApi.cs

示例8: DateTimePicker

        public static MvcHtmlString DateTimePicker(this HtmlHelper helper, string name, bool formGroup, DateTime? value, string dateTimeFormat, CultureInfo culture = null, IDictionary<string, object> htmlProps = null)
        {
            var dateFormat = SplitDateTimeFormat(dateTimeFormat, culture);

            if (dateFormat.TimeFormat == null)
                return helper.DatePicker(name, formGroup, value?.ToString(dateFormat.DateFormat, culture), ToJsDateFormat(dateFormat.DateFormat), culture, htmlProps);

            if(dateFormat.DateFormat == null)
                return helper.TimePicker(name, formGroup, value?.ToString(dateFormat.TimeFormat, culture), dateFormat.TimeFormat, htmlProps);

            HtmlStringBuilder sb = new HtmlStringBuilder();
            using (sb.SurroundLine(new HtmlTag("div", name).Class("date-time")))
            {
                sb.Add(helper.DatePicker(TypeContextUtilities.Compose(name, "Date"), formGroup, value?.ToString(dateFormat.DateFormat, culture), ToJsDateFormat(dateFormat.DateFormat), culture, htmlProps));
                sb.Add(helper.TimePicker(TypeContextUtilities.Compose(name, "Time"), formGroup, value?.ToString(dateFormat.TimeFormat, culture), dateFormat.TimeFormat, htmlProps));
            }
            return sb.ToHtml();
        }
开发者ID:rondoo,项目名称:framework,代码行数:18,代码来源:CalendarHelper.cs

示例9: SearchAsync

 public Task<IList<MandrillMessageInfo>> SearchAsync(string query, DateTime? dateFrom = null,
     DateTime? dateTo = null, IList<string> tags = null, IList<string> senders = null,
     IList<string> apiKeys = null, int? limit = null)
 {
     return
         MandrillApi.PostAsync<MandrillMessageSearchRequest, IList<MandrillMessageInfo>>("messages/search.json",
             new MandrillMessageSearchRequest
             {
                 DateFrom = dateFrom?.ToString(SearchDateFormat),
                 DateTo = dateTo?.ToString(SearchDateFormat),
                 Query = query,
                 Tags = tags?.ToList(),
                 Senders = senders?.ToList(),
                 ApiKeys = apiKeys?.ToList(),
                 Limit = limit
             });
 }
开发者ID:ChrisEby,项目名称:Mandrill.net,代码行数:17,代码来源:MandrillMessagesApi.cs

示例10: SearchTimeSeriesAsync

 public Task<IList<MandrillMessageTimeSeries>> SearchTimeSeriesAsync(string query, DateTime? dateFrom = null,
     DateTime? dateTo = null, IList<string> tags = null,
     IList<string> senders = null)
 {
     return
         MandrillApi.PostAsync<MandrillMessageSearchRequest, IList<MandrillMessageTimeSeries>>(
             "messages/search-time-series.json",
             new MandrillMessageSearchRequest
             {
                 DateFrom = dateFrom?.ToString(SearchDateFormat),
                 DateTo = dateTo?.ToString(SearchDateFormat),
                 Query = query,
                 Tags = tags?.ToList(),
                 Senders = senders?.ToList()
             });
 }
开发者ID:ChrisEby,项目名称:Mandrill.net,代码行数:16,代码来源:MandrillMessagesApi.cs

示例11: FormatDate

 public static string FormatDate(DateTime? date)
 {
     return date?.ToString("MM/dd/yyyy");
 }
开发者ID:RadcoIT,项目名称:RadConstr,代码行数:4,代码来源:Utility.cs

示例12: GetFormattedDate

 public static string GetFormattedDate(DateTime? date) => date?.ToString(format: DateFormat) ?? string.Empty;
开发者ID:uvarajthulasiram,项目名称:TrustMoi,代码行数:1,代码来源:FormatUtility.cs

示例13: Iso8601

 /// <summary>
 /// Type-safe helper method for R.Iso8601
 /// </summary>
 public Iso8601 Iso8601(DateTime? datetime)
 {
     var str = datetime?.ToString("o");
     return Ast.Iso8601.FromString(str);
 }
开发者ID:fjsnogueira,项目名称:RethinkDb.Driver,代码行数:8,代码来源:TopLevel.cs


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