Datatime value issue

Peter_1985 2,736 Reputation points
2024-05-30T08:28:23.0166667+00:00

Hi,

How to correct it below?

            tb_apply_date.Text = Datetime.Now.ToString();
Developer technologies | Visual Studio | Other
Developer technologies | C#
{count} votes

Accepted answer
  1. Anonymous
    2024-05-30T09:46:25.0266667+00:00

    Hi @Peter_1985 , Welcome to Microsoft Q&A,

    In C#, the class for handling date and time is DateTime, not Datetime.

    
    tb_apply_date.Text = DateTime.Now.ToString();
    
    

    If you want to format the date and time in a specific way, you can use the ToString method with a format string. For example, if you want to display the date and time in the format "MM/dd/yyyy HH:mm:ss", you can do it like this:

    
    tb_apply_date.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
    
    

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.