Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7827827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:03:47+00:00 2026-06-02T10:03:47+00:00

I have that code for Job – just log info to database public class

  • 0

I have that code for Job – just log info to database

 public class Job : IJob 
    { 
        private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType); 
        #region IJob Members 
        public void Execute(IJobExecutionContext context) 
        { 
            // This job simply prints out its job name and the 
            // date and time that it is running 
            JobKey jobKey = context.JobDetail.Key; 
            log.InfoFormat("SimpleJob says: {0} executing at {1}", 
jobKey, DateTime.Now.ToString("r")); 
        } 
        #endregion 
    } 

My singleton scheduler class

public class Scheduler 
    { 
        static Scheduler() 
        { 
            NameValueCollection properties = new 
NameValueCollection(); 
            properties["quartz.scheduler.instanceName"] = "myApp"; 
            properties["quartz.scheduler.instanceId"] = "MyApp"; 
            properties["quartz.threadPool.type"] = 
"Quartz.Simpl.SimpleThreadPool, Quartz"; 
            properties["quartz.threadPool.threadCount"] = "10"; 
            properties["quartz.threadPool.threadPriority"] = "Normal"; 
            properties["quartz.scheduler.instanceName"] = 
"TestScheduler"; 
            properties["quartz.scheduler.instanceId"] = 
"instance_one"; 
            properties["quartz.jobStore.type"] = 
"Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"; 
            properties["quartz.jobStore.useProperties"] = "true"; 
            properties["quartz.jobStore.dataSource"] = "default"; 
            properties["quartz.jobStore.tablePrefix"] = "QRTZ_"; 
            // if running MS SQL Server we need this 
            properties["quartz.jobStore.lockHandler.type"] = 
"Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz"; 
            properties["quartz.dataSource.default.connectionString"] = 
"Server=localhost;Database=quartzr;Uid=user;Pwd=pass"; 
            properties["quartz.dataSource.default.provider"] = 
"SqlServer-20"; 
            _schedulerFactory = new StdSchedulerFactory(properties); 
            _scheduler = _schedulerFactory.GetScheduler(); 
        } 
        public static IScheduler GetScheduler() 
        { 
            return _scheduler; 
        } 
        private static readonly ISchedulerFactory _schedulerFactory; 
        private static readonly IScheduler _scheduler; 
    } 

Global.asax start scheduler

void Application_Start(object sender, EventArgs e) 
        { 
            Scheduler.GetScheduler().Start(); 
        } 

And code to add jobs

 DateTime SelectedDate = this.Calendar1.SelectedDate; 
                int hour = this.TimeSelector1.Hour; 
                int minute = this.TimeSelector1.Minute; 
                int second = this.TimeSelector1.Second; 
                // First we must get a reference to a scheduler 
                // jobs can be scheduled before sched.start() has been 
called 
                // get a "nice round" time a few seconds in the 
future... 
                DateTimeOffset startTime = DateBuilder.DateOf(hour, 
minute, second, SelectedDate.Day, SelectedDate.Month, 
SelectedDate.Year); 
                try 
                { 
                    // job1 will only fire once at date/time "ts" 
                    IJobDetail job = JobBuilder.Create<Job>() 
                        .WithIdentity("job1", "group1") 
                        .Build(); 
                    ISimpleTrigger trigger = 
(ISimpleTrigger)TriggerBuilder.Create() 
                                                                  .WithIdentity("trigger1", 
"group1") 
                                                                  .StartAt(startTime) 
                                                                  .Build(); 
                    // schedule it to run! 
                    DateTimeOffset? ft = 
Scheduler.GetScheduler().ScheduleJob(job, trigger); 
                    log.Info(job.Key + 
                             " will run at: " + ft); 
                    this.Label1.Text = "Zdarzenie dodane"; 
                } 
                catch (Exception ex) 
                { 
                    log.Error(ex.Message, ex); 
                } 

Problem is that jobs was add to db, but it fire immediately, not at
specific time by me :/ I use latest library Quartz.NET 2.0 beta 2
Do I something wrong in code? I begginer with this API, please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:03:48+00:00Added an answer on June 2, 2026 at 10:03 am

    Quartz.Net expects that you pass in dates and times in UTC. Try changing this line:

    .StartAt(startTime) 
    

    to

    .StartAt(startTime.ToUniversalTime())
    

    or, make sure that startTime is in UTC before passing it in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that looks like this: template<class T> class list { public: class
I have a java code that looks like this: //UI thread //Some code Job
I have code that is similar to this: public xyz (int? a) { if
I have some code that behaves like this: class Base {}; class MyClass :
I have a segment of code that gets executed everytime a backend database change
I have code that I want to look like this: List<Type> Os; ... foreach
I have code that uses Win API function RegSaveKeyEx to save registry entries to
I have code that uses jquery.slideup and jquery.slidedown How can i know that div
I have code that calls an ENTRY in a SUBROUTINE before the SUBROUTINE .
I have code that I want to compile on all unix systems, but if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.