Announcement Announcement Module
Collapse
No announcement yet.
Scheduling Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scheduling

    I would like to know how to set the cron expression with respect to GMT time.

    For eg. I have @Scheduled(cron = '0 0 0 * * *').should I add the time difference to the cron expression


    Thanks

  • #2
    That will use the default TimeZone (internally it calls TimeZone.getDefault()). Is that not GMT in your case?

    Comment


    • #3
      Well, if you are interested in the adjustment to current/default timezone then you don't need to do anything since CronTrigger will always use a Default TimeZone if one is not provided.
      However if not you'd need to specify it.

      We probably need to expose TimeZone attribute somehow, but for now all you need to do is specify a reference to CronTrigger instance. For example:
      Code:
      <bean id="cronTrigger" class="org.springframework.scheduling.suppor.CronTrigger">
          <constructor-arg value="your cron expression"/>
          <constructor-arg ref="ref to a TimeZone bean">
      </bean>

      Comment


      • #4
        Well, if you are interested in the adjustment to current/default timezone then you don't need to do anything since CronTrigger will always use a Default TimeZone if one is not provided.
        However if not you'd need to specify it.

        We probably need to expose TimeZone attribute somehow, but for now all you need to do is specify a reference to CronTrigger instance. For example:
        Code:
        <bean id="cronTrigger" class="org.springframework.scheduling.suppor.CronTrigger">
            <constructor-arg value="your cron expression"/>
            <constructor-arg ref="ref to a TimeZone bean">
        </bean>

        Comment


        • #5
          Yes Mark, its not GMT in my case, it is PST.

          Should a timezone bean class needs to be defined and how can cron trigger be specified in the scheduled annotation.

          Thanks

          Comment


          • #6
            Is it possible to give a timezone attribute in the scheduled annotation.


            Thanks

            Comment


            • #7
              Please clarify how to give the reference to the cronTrigger in the scheduled annotation

              Please help.

              Thanks

              Comment


              • #8
                Please tell me how to start the task at 12.00 am GMT time everyday,that can be specified in the cron expression in the scheduled annotation .

                Thanks a lot to help me with this.

                Comment


                • #9
                  Originally posted by newbie_24 View Post
                  Please tell me how to start the task at 12.00 am GMT time everyday,that can be specified in the cron expression in the scheduled annotation .

                  Thanks a lot to help me with this.
                  Following cron expression will let you run at 12:00AM:-


                  <property name="cronExpression" value="0 0 12 * * ?" />

                  Comment

                  Working...
                  X