3

We're currently using the API to create campaigns, and all seems to be working fine. When we try to schedule the campaign, however, we are getting errors. When we try to use the example format for 'schedule_date' from one of the SDK libraries:

$time =  date('Y-m-d\TH:i:s\.000\Z', strtotime("+1 hour"));
$schedule = new Schedule();
$schedule->scheduled_date = $time;

We get an error that saying

Scheduled date is before the current time.

When we echo the $time to the screen, we see that it is in fact one hour in the future. (We are in EST).

When we try to use the standard PHP format for ISO-8601 (lowercase 'c') we get and error saying

"#/scheduled_date: Value is not a valid ISO-8601 date time format."

$dt =  date('c', strtotime("+1 hour"));
schedule = new Schedule();
`$schedule->scheduled_date = $dt

I'm sure there is something obvious we are missing, so any help would be greatly appreciated.

user247702
  • 23,641
  • 15
  • 110
  • 157
Dave
  • 61
  • 1
  • 3
  • We should probably use DateTime in conjunction with DateTimeZone to know for sure that we're working with proper time zone so we eliminate one potential problem first. – N.B. Nov 08 '13 at 13:14

1 Answers1

1

I would definitely try using the DateTime class (http://php.net/manual/en/class.datetime.php) in conjunction with DateTimeZone to see if that alleviates the issue.

We've also updated our Date/Time parser to accept more formats, which should hopefully take care of the issue you ran into when trying to use date('c')

If you keep running into issues let me know!

Thanks, Mike

ctct_mike
  • 76
  • 2