asp.net.ph

Skip Navigation Links

Setting Today’s Date Programmatically

Controls You Can Use on Web Forms   ASP.NET Standard Controls   Calendar Control


By default, the value of "today" in the Calendar control is set to match the date of the server on which the Web Forms page runs. However, you might need to adjust the date to accommodate users who are viewing the page from a different time zone.

To set today’s date programmatically

  • Set the Calendar control’s TodaysDate property to a DateTime value, as in the following example:
now = new DateTime ( )
’ increment by one day here
Calendar1.TodaysDate = now

The following example shows how you can get locale information from the browser and then use that information to adjust the value of today’s date if necessary.



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note