Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Monday, September 9, 2013

Set the date format

How to Set the current data into Asp text box in asp.net :


In asp.net programming it is very simple that u set the current date in specific format .if u want to set the current date in time and date both the  use:

Set Date:

TextBox1.Text=DateTime.Now.Date.ToString();

here TextBox1 is the Textbox id and dateTime.Now is function.
we want to set the current date with time in Text property of text.



how to to set the date format in to gridview in asp.net programming :

for this we use DateTime.Now.Date.ToString(); the current date set in textbox in String format.
If You want to want a specific  format the Give format in to ToString() function as like,

TextBox1.Text=DateTime.Now.Date.ToString("dd-MMM-yyy");

Format DateTime:

Where 
dd-MMM-yyy is a format of date :
  • dd- refer to date ,
  • MMM refer to Month, 
  • yyyy refer to Year.



Other Related Post :

Asp.net related post And Examples:

No comments:

Post a Comment