menu

UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DateTimeExtension - UWP API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DateTimeExtension

    Represents an extension class that provides the methods for obtaining the first and last days of a month corresponding to the provided System.DateTime object such as year, month, or week.

    Inheritance
    System.Object
    DateTimeExtension
    Namespace: Syncfusion.UI.Xaml.Controls
    Assembly: Syncfusion.SfShared.UWP.dll
    Syntax
    public static class DateTimeExtension : Object

    Methods

    EachDayInMonth(DateTime)

    Returns an enumerator collection of each day in the month corresponding to the provided System.DateTime object.

    Declaration
    public static IEnumerable<DateTime> EachDayInMonth(this DateTime datetime)
    Parameters
    Type Name Description
    System.DateTime datetime

    date time value

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.DateTime>

    returns each day in the given month

    FirstDay(DateTime)

    Calculates the first day of a month corresponding to the provided System.DateTime object.

    Declaration
    public static DateTime FirstDay(this DateTime dateTime)
    Parameters
    Type Name Description
    System.DateTime dateTime

    date time value

    Returns
    Type Description
    System.DateTime

    the first day of a month corresponding to the provided System.DateTime object

    LastDay(DateTime)

    Calculates the last day of a month corresponding to the provided System.DateTime object.

    Declaration
    public static DateTime LastDay(this DateTime dateTime)
    Parameters
    Type Name Description
    System.DateTime dateTime

    date time value

    Returns
    Type Description
    System.DateTime

    Returns the last day the last day of a month corresponding to the provided System.DateTime object

    StartOfWeek(DateTime, DayOfWeek)

    Calculates the starting day of a week corresponding to the provided System.DateTime object.

    Declaration
    public static int StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
    Parameters
    Type Name Description
    System.DateTime dt

    date time value

    System.DayOfWeek startOfWeek

    starting day of week

    Returns
    Type Description
    System.Int32

    the starting day of a week corresponding to the provided System.DateTime object

    ToDateTime(Object)

    Converts the specified object representation of date and time to its System.DateTime equivalent.

    Declaration
    public static DateTime ToDateTime(this object dateTime)
    Parameters
    Type Name Description
    System.Object dateTime

    date time value

    Returns
    Type Description
    System.DateTime

    Returns the System.DateTime of the given object

    ToDateTime(String, String)

    Converts the string representation of date and time into a DateTime object using a specified format.

    Declaration
    public static DateTime ToDateTime(this string dateTime, string format)
    Parameters
    Type Name Description
    System.String dateTime

    date time value

    System.String format

    The format to which the date and time should be converted

    Returns
    Type Description
    System.DateTime

    Returns the System.DateTime of the given object

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved