What are the methods and functions for displaying current time and date in C#?

  • Thread starter Thread starter CodeMonkey
  • Start date Start date
Click For Summary

Discussion Overview

The discussion focuses on methods and functions for displaying the current time and date in C#. Participants explore various approaches and resources available for this task.

Discussion Character

  • Technical explanation

Main Points Raised

  • One participant inquires about methods to display or return the current time and date in C#.
  • Another participant suggests that a quick Google search yields many useful resources related to C# time and date functions.
  • A different participant mentions the function GetlocalTime() as a possible solution and recommends checking MSDN for more information.
  • Yet another participant provides a specific code example using System.Console.WriteLine(System.DateTime.Now) to display the current date and time.

Areas of Agreement / Disagreement

Participants generally agree on the availability of multiple methods to achieve the desired outcome, but there is no consensus on which method is superior or preferred.

CodeMonkey
Messages
11
Reaction score
0
What methods and functions can I use to make the program display or return the current time and date in C#? Thanks.
 
Technology news on Phys.org
It's almost embarrassing how many useful hits a quick Google search for "C# time date" yields...
 
Thanks, and sorry. I will learn to Google before asking next time.

Cheers.
 
GetlocalTime() can do it
you can search it in MSDN.
 
Code:
System.Console.WriteLine(System.DateTime.Now);
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
5
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
4K
  • · Replies 64 ·
3
Replies
64
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K