C# DateTimeOffset DayOfWeek

Description

DateTimeOffset DayOfWeek gets the day of the week represented by the current DateTimeOffset object.

Syntax

DateTimeOffset.DayOfWeek has the following syntax.


public DayOfWeek DayOfWeek { get; }

Example

The following example displays the weekday name of the first day of each month of the year 2014.


using System;//  w  ww .  j  av  a2 s  .  c  om

public class MainClass{
  public static void Main(String[] argv){  
    DateTimeOffset startOfMonth = new DateTimeOffset(2014, 1, 1, 0, 0, 0, 
                                             DateTimeOffset.Now.Offset);
    Console.WriteLine("{0:MMM d, yyyy} is a {1}.", startOfMonth, startOfMonth.DayOfWeek);

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version