如何使用Asp.net显示在文本框中的当前日期 [英] How to show the Current date in textBox using Asp.net

查看:554
本文介绍了如何使用Asp.net显示在文本框中的当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何一个可以告诉我,我怎么能打印当前数据以这种格式(DD-MM-YYYY)

我用这个命令,但它不工作:

 保护无效TextBoxStartDate_TextChanged(对象发件人,EventArgs的发送)
        {
              TextBoxStartDate.Text = DateTime.Now.ToString();
           // TextBoxStartDate.Text = DateTime.Now();
        }

我想自动填充文本框使用当前日期


解决方案

  

如何打印这种格式的当前数据(DD-MM-YYYY)


下的毫米表示分钟.. !!

您可以使用此格式:

  DateTime.Now.ToString(DD-MM-YYYY);

更改code是这样的:

 保护无效TextBoxStartDate_TextChanged(对象发件人,EventArgs的发送)
    {
    TextBoxStartDate.Text = DateTime.Now.ToString(DD-MM-YYYY);
       // TextBoxStartDate.Text = DateTime.Now();
    }

Can any one tell me how can I print the current data in this format (dd-mm-yyyy) ?

I am using this command, but it is not working:

protected void TextBoxStartDate_TextChanged(object sender, EventArgs e)
        {
              TextBoxStartDate.Text = DateTime.Now.ToString();
           // TextBoxStartDate.Text = DateTime.Now();
        }

I want autofill textbox with a current date

解决方案

how can i print the current data in this format (dd-mm-yyyy)

Lower mm means minutes..!!

You can use this format:

DateTime.Now.ToString("dd-MM-yyyy");

Change your code like this:

protected void TextBoxStartDate_TextChanged(object sender, EventArgs e)
    {
    TextBoxStartDate.Text = DateTime.Now.ToString("dd-MM-yyyy");
       // TextBoxStartDate.Text = DateTime.Now();
    }

这篇关于如何使用Asp.net显示在文本框中的当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆