title: How Would I Execute an Event at a Specific Time
body: <p>Currently I am trying to create an timer that notifies me at a specific time every week(1:00PM on Thursday). The problem I am facing right now is that how would I trigger the timer to start without doing any action. I need the timer to start by itself everytime upon bot startup. Any help is appreciated.</p>
  <p>Here's my code:</p>
  <pre><code>public class Reminder extends ListenerAdapter {
      @Override
      public void onGuildMessageReceived(GuildMessageReceivedEvent e) {
          if (e.getGuild().getId().equalsIgnoreCase(&quot;77804326694381163&quot;)) {
              TextChannel defaultChannel = e.getGuild().getDefaultChannel();
              if (defaultChannel != null) {
                  Calendar time = Calendar.getInstance();
                  ZoneId zoneId = ZoneId.of(&quot;America/Los_Angeles&quot;);
                  time.setTimeZone(TimeZone.getTimeZone(zoneId));
                  Date timeGet = time.getTime();
  
                  DateFormat df = new SimpleDateFormat(&quot;EE HH:mm:ss&quot;);
                  String string = df.format(timeGet);
  
                  if (string.equalsIgnoreCase(&quot;Thu 13:00:00&quot;)) {
                      Timer timer = new Timer();
                      timer.schedule(new TimerTask() {
                          @Override
                          public void run() {
                              defaultChannel.getChannel().sendTyping().queue();
                              defaultChannel.getChannel().sendMessage(&quot;Works&quot;).queue();
                          }
                      }, time.getTime(), TimeUnit.MILLISECONDS.convert(7, TimeUnit.DAYS));
                  }
  
              } else if (defaultChannel == null) {
                  e.getChannel().sendTyping().queue();
                  e.getChannel().sendMessage(&quot;Failed to get default channel.&quot;).queue();
              }
          }
      }
  }
  </code></pre>