This is a simple C# program that returns the current date and time in various formats. This program uses the DateTime.Now property to get the current date and time. This C# code has separate function that takes a DateTime object and a date/time format as parameters and returns the formatted date/time string. The Main function then passes various date/time formats to this function and prints the results:

In this code, the PrintFormattedDateTime function takes a DateTime object and a date/time format as parameters, and it prints the formatted date/time string using the GetFormattedDateTime function. The GetFormattedDateTime function takes the same parameters and returns the formatted date/time string using the ToString method with the specified format.