Objective
Create a program to display the current date and time with the following format:
Today is 6 of February of 2015. It´s 03:23:12
Write Your C# Exercise
C# Exercise Example
// Import the System namespace which provides fundamental classes for date, time, and console operations
using System;
class Program
{
// Main method to execute the program
static void Main()
{
// Get the current date and time
DateTime currentDateTime = DateTime.Now; // Retrieve the current system date and time
// Display the current date and time in the specified format
Console.WriteLine($"Today is {currentDateTime.Day} of {currentDateTime.ToString("MMMM")} of {currentDateTime.Year}. It´s {currentDateTime.ToString("HH:mm:ss")}");
}
}
Explore our set of C# programming exercises! Specifically designed for beginners, these exercises will help you develop a solid understanding of the basics of C#. From variables and data types to control structures and simple functions, each exercise is crafted to challenge you incrementally as you build confidence in coding in C#.
In this exercise, you need to create a program that shows all the files in the current folder. The program should list the files available in the directory where the program...
In this exercise, you need to create a program that shows the names of all executable files (.com, .exe, .bat, .cmd) in the current folder, excluding the full path. The prog...
In this exercise, you need to create a program that displays the current time in the top-right corner of the screen with the format "HH:mm:ss". The program should pause for ...
In this exercise, you need to create a program that displays the contents of a preliminary "sitemap" on the screen. The sitemap should be generated from the list of "...
In this exercise, you need to create a program that generates an HTML file listing all the images (PNG and JPG files) in the current folder. The program...
In this exercise, you need to create a program that displays specific system details, including the computer name, domain name, and the username of the current...