locked
Today's date is already disabled even though it is not yet 12:00am. RRS feed

  • Question

  • User1710381951 posted

    Hi!

    How can I get the current time zone of my PC when using the Calendar Extender?
    My problem is that after 04:00 PM in my country, it automatically disables the current date even though it's not yet 12:00 in the midnight.

    Here's my code:

     protected void Page_Load(object sender, EventArgs e) {
                cal_DateFrom.StartDate = DateTime.Now;
     }
    Friday, March 24, 2017 8:36 AM

All replies

  • User527778624 posted

    Hi,

    It seems your system's Timezone is not set properly, Try updating it:

    http://www.di-mgt.com.au/wclock/help/wclo_setsysclock.html

    Friday, March 24, 2017 9:44 AM
  • User2103319870 posted

    How can I get the current time zone of my PC when using the Calendar Extender?
    My problem is that after 04:00 PM in my country, it automatically disables the current date even though it's not yet 12:00 in the midnight.

    You might considering using the below code to convert your datetime which uses TimeZone as well. I have set it to US Standards, You can set it as per your country. Use the list available here to find the name of timezone for your country

    cal_DateFrom.StartDate = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));

    Friday, March 24, 2017 1:53 PM
  • User-1838255255 posted

    Hi RedRailgun,

    How can I get the current time zone of my PC when using the Calendar Extender?

    According to your description, about how to get the time zone, please check the following code:

     TimeZone date = TimeZone.CurrentTimeZone;
    

    I think you could to get the current hour in DayRender event, if hour greater than 3, disable the current day.

    Best Regards,

    Eric Du

    Sunday, March 26, 2017 6:30 AM