Q:

Write a C# Sharp program to display the Day properties (year, month, day, hour, minute, second, millisecond etc.)

0

Write a C# Sharp program to display the Day properties (year, month, day, hour, minute, second, millisecond etc.). 

Expected Output :

year = 2016                                                                      
month = 8                                                                        
day = 16                                                                         
hour = 3                                                                         
minute = 57                                                                      
second = 32                                                                      
millisecond = 11  

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;

public class Example2
{
   public static void Main()
   {
    System.DateTime moment = new System.DateTime(2016, 8, 16, 3, 57, 32, 11);
	Console.WriteLine("year = " +moment.Year);
	Console.WriteLine("month = " +moment.Month);
	Console.WriteLine("day = " +moment.Day);
	Console.WriteLine("hour = " +moment.Hour);
	Console.WriteLine("minute = " +moment.Minute);
	Console.WriteLine("second = " +moment.Second);
	Console.WriteLine("millisecond = " +moment.Millisecond);
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now