是否可以在特定日期/时间调用cron作业?

I am using what seems to be the most popular cron package by robfig: https://godoc.org/github.com/robfig/cron. Currently I know that I can invoke an hourly cron job with:

c.AddFunc("@hourly", func() { fmt.Println("Every hour") })

However I wonder if it is possible to set it so that it only starts after (for example) Sep 1st, 2017? If it's not possible using that package, how else can I achieve that? Thanks.

Adding to @Adrians Comments,

The package robfig/cron supports cron expression format. To have the cron run 30 mins past every hour viz on 9:30 am,10:30 am, 11:30 am. You could use

c.AddFunc("0 30 * * * *", func() {})

an implementation to have the cron run after Sep 1, 2017

package main

import (
    "fmt"
    "time"
    "github.com/robfig/cron"
)

func main() {

    // time set to Sep 1, 2017 00:00 Hours UTC
    t := time.Date(2017, time.September, 1, 0, 0, 0, 0, time.UTC) 

    c := cron.New()

    //using cron expression format to have the function run every hour on the half hour
    c.AddFunc("0 30 * * * *", func() {      

        if time.Now.After(t){
        fmt.Println("yay")
        //insert logic block
        } 
     })

}

Note: The cron expression format used by this package is different from the standard unix cron format. The expression format used by this package allows for second precision unlike unix cron format.

If you want a custom scheduling, implements your own scheduler, then register the job using Cron.Schedule. Below is an example implementation of repeating a CRON job after a certain time:

package main

import (
    "fmt"
    "time"

    "github.com/robfig/cron"
)

type MyScheduler struct {
    At    time.Time
    Every time.Duration
}

func (s *MyScheduler) Next(t time.Time) time.Time {
    if t.After(s.At) {
        return t.Add(s.Every)
    }

    return s.At
}

func main() {
    c := cron.New()

    //Execute every 2 seconds after a certain time (5 second from now)
    now := time.Now()
    at := now.Add(5 * time.Second) //In your case, this should be: Sep 1st, 2017
    s := &MyScheduler{at, 2 * time.Second}

    c.Schedule(s, cron.FuncJob(
        func() {
            cur := time.Now()
            fmt.Printf("  [%v] CRON job executed after %v
", cur, cur.Sub(now))
        }))

    fmt.Printf("Now: %v
", now)
    c.Start()
    time.Sleep(10 * time.Second)
    c.Stop()
}