interesting fact about date.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi

I have not seen anything yet that can help me with this.

All the time my page is loaded I need to show inside a TextBoxt the first
day of the month:

If the page is being loaded this month the textboxt should have

06/01/2005

If the page is being loaded the next month the textboxt should have

07/01/2005

If the page is being loaded at december:

12/01/2005

any sug?
 
Depending on your needs, you could try setting the Text of the TextBox to a
serialized string that you make. Grab the Month and Year parts of the
current month and put '/01/' between them and assign that string to the Text
property.

This may not work as well if you have a localized app where user format
settings take effect. Is this the case?

HTH,
-Ryan
 
int d=(DateTime.Now.Day-1)*-1; //today-1
DateTime date1=DateTime.Now.AddDays(d); //move back d days
txt1stDayOfMonth.Text="1st Day: "+string.Format("{0:MM/dd/yyyy}",date1);
//show it

Is that what you want ?

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top