locked
Win32_ScheduledJob Start Time Diff Hard Code Vs DateTime.Now() RRS feed

  • Question

  • Hello and I am sure there is something I am over looking and quick question why would this line of code:

    //inParams["StartTime"] = "********175530.000000-300";

    Set the Start time with todays date of exampe 01/03/2011

    Now if I do this with the DateTime Object in .Net

    //inParams[

    "StartTime"] = "********" + dt.AddSeconds(5).ToString("HHmmss") + ".000000-300";

    The Start time get set with the Time but tomorrow's date of 01/04/2011. Thoughts? What am I over looking?

    Monday, January 3, 2011 9:16 PM

All replies

  • From the documentation http://msdn.microsoft.com/en-us/library/aa394399(VS.85).aspx:

    StartTime
    Data type: datetime
    Access type: Read-only

     

    UTC time to run the job, in the form of "YYYYMMDDHHMMSS.MMMMMM(+-)OOO", where "YYYYMMDD" must be replaced by "********". The replacement is necessary because the scheduling service only allows jobs to be configured to run one time, or run on a day of the month or week. A job cannot be run on a specific date.

    The "(+-)OOO" section of the StartTime property value is the current bias for local time translation. The bias is the difference between the UTC time and local time. To calculate the bias for your time zone, multiply the number of hours that your time zone is ahead or behind Greenwich Mean Time (GMT) by 60 (use a positive number for the number of hours if your time zone is ahead of GMT and a negative number if your time zone is behind GMT). Add an additional 60 to your calculation if your time zone is using daylight savings time. For example, the Pacific Standard Time zone is eight hours behind GMT, therefore the bias is equals to -420 (-8 * 60 + 60) when daylight savings time is in use and -480 (-8 * 60) when daylight savings time is not in use. You can also determine the value of the bias by querying the bias property of the Win32_TimeZone class.

    For example: "********123000.000000-420" specifies 14.30 (2:30 P.M.) PST with daylight savings time in effect.

    regards 


    Espen Harlinn
    Tuesday, January 11, 2011 9:47 AM