.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Show today weekday

Posted By:laptop charles       Posted Date: August 09, 2010    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

It display today weekday...

It has used DateTime class.
It shows today weekday like "sunday"and "monday" and etc.
using System;
using System.Collections.Generic;
using System.Text;

namespace datetimemethod
    class Program
        static void Main(string[] args)
            DateTime today;
            today = DateTime.Now;

            if (today.DayOfWeek == DayOfWeek.Sunday)
                Console.WriteLine("Today Sunday");
            if (today.DayOfWeek == DayOfWeek.Monday )
                Console.WriteLine("Today Monday");
            if (today.DayOfWeek == DayOfWeek.Tuesday )
                Console.WriteLine("Today Tuesday");
            if (today.DayOfWeek == DayOfWeek.Wednesday )
                Console.WriteLine("Today Wednesday");
            if (today.DayOfWeek == DayOfWeek.Thursday )
                Console.WriteLine("Today Thursday");
            if (today.DayOfWeek == DayOfWeek.Friday )
                Console.WriteLine("Today Friday");
            if (today.DayOfWeek == DayOfWeek.Saturday )
                Console.WriteLine("Today Saturday");



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend