I am using devbay's eBay SDK for PHP.
By default SoldReport is returning the last 30 days.
I'm trying to filter the date range to specify one-day/24 hour period.
I'm assuming I need to include a date range filter somewhere in the StartDownloadJobRequest call.
$startDownloadJobRequest = new BulkDataExchange\Types\StartDownloadJobRequest();
$startDownloadJobRequest->downloadJobType = 'SoldReport';
$startDownloadJobRequest->UUID = uniqid();
$startDownloadJobRequest->downloadRequestFilter = new BulkDataExchange\Types\DownloadRequestFilter();
$startDownloadJobRequest->downloadRequestFilter->activeInventoryReportFilter = $activeInventoryReportFilter;
I tried CreateTimeFrom and CreateTimeTo but received an Unknown property CreateTimeFrom error, so I do not believe I can use that for this request.
Anyone know how to filter date range in reports?
edit:
So it looks like startTime and endTime is apart of DownloadRequestFilter
DownloadRequestFilter DateTime
I thought something like this would work..
$datefilter = new BulkDataExchange\Types\DateFilter();
$datefilter->startTime = new DateTime('22-10-2016');
$datefilter->endTime = new DateTime('23-10-2016');
//
$startDownloadJobRequest->downloadRequestFilter->dateFilter = $datefilter;
but this doesn't work and I still get all results.
Related
I've exported reviews from mysql db in a csv format, and I've included created_at field. Now, when I open CSV file, date is in following format: 2014-02-04 13:31:43. So, I now want to import those reviews into different website, and everything works except for created_at date, for which I'm using following code:
// $_row['created_at'] = '2014-02-04 13:31:43';
// $_review is the object I created with
// $_review = Mage::getModel('review/review');
$_created_at = Mage::helper('core')->formatDate($_row['created_at'], 'medium', false);
$_review->setCreatedAt($_created_at);
but that doesn't set created_at properly. What's the correct way of achieving this?
Try this ...
$createdtime = new Zend_Date(strtotime($_row['created_at']));
$_created_at = Mage::getModel('core/date')->date('M d, Y', $createdtime);
$_review->setCreatedAt($_created_at);
I am trying to add a contact in Exchange, using the php-ews and the following code:
$request = new EWSType_CreateItemType();
$request->SendMeetingInvitations = 'SendToNone';
$contact = new EWSType_ContactItemType();
$contact->GivenName = $updates['name'];
$contact->Surname = $updates['surname'];
if($updates['email'] != ""){
$email = new EWSType_EmailAddressDictionaryEntryType();
$email->Key = new EWSType_EmailAddressKeyType();
$email->Key->_ = EWSType_EmailAddressKeyType::EMAIL_ADDRESS_1;
$email->_ = $updates['email'];
// set the email
$contact->EmailAddresses = new EWSType_EmailAddressDictionaryType();
$contact->EmailAddresses->Entry[] = $email;
}
$contact->CompanyName = $updates['companyname'];
$contact->JobTitle = $updates['jobtitle'];
$contact->Birthday = $updates['birthday'];
$request->Items->Contact[] = $contact;
$response = $this->ews->CreateItem($request);
Where $updates is an array of strings I have as a parameter.
(I skipped the includes, tell me if you need them.)
Now, the contact gets created and everything works, but the birthday event does not get created automatically in my calendar.
So, I would like to know if there's a simple way to have this done, except the obvious (non-elegant) way of creating it manually.
Thank you in advance,
Riccardo
Could solve this using DateTime in the right format as expected in the comments.
$contact->Birthday = (new DateTime($updates['birthday']))->format(DATE_W3C);
https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/time-zones-and-ews-in-exchange
The time zone specified in the value of dateTime elements can take three forms. You can read all the details in XML Schema Part 2: Datatypes Second Edition, but to paraphrase:
Universal Coordinated Time (UTC): Specified by 'Z'. For example, 2014-06-06T19:00:00.000Z
Specific time zone: Specified by '+' or '-' followed by hours and minutes. For example, 2014-06-06T19:00:00.000-08:00
No time zone: Specified by the absence of any time zone. For example, 2014-06-06T19:00:00.000
I am trying to create a recurring calendar event with php-ews and the documentation is very limited in this aspect. I have got what is below so far I just can not find out how to have it repeat say every Monday and Wednesday. Can anyone who has done this before or knows how help me out?
$request->Items->CalendarItem->Recurrence = new Type\RecurrenceType();
$request->Items->CalendarItem->Recurrence->WeeklyRecurrence = new Type\IntervalRecurrencePatternBaseType();
$request->Items->CalendarItem->Recurrence->NumberedRecurrence = new Type\NumberedRecurrenceRangeType();
$request->Items->CalendarItem->Recurrence->NumberedRecurrence->NumberOfOccurrences = 2;
$request->Items->CalendarItem->Recurrence->NumberedRecurrence->StartDate = //start date here;
I've successfully used this...
// Set up recurrence days
$request->Items->CalendarItem->Recurrence = new EWSType_RecurrenceType();
$request->Items->CalendarItem->Recurrence->WeeklyRecurrence = new EWSType_IntervalRecurrencePatternBaseType();
$request->Items->CalendarItem->Recurrence->WeeklyRecurrence->Interval = 1;
$request->Items->CalendarItem->Recurrence->WeeklyRecurrence->DaysOfWeek = new EWSType_ArrayOfStringsType();
$request->Items->CalendarItem->Recurrence->WeeklyRecurrence->DaysOfWeek = array(EWSType_DayOfWeekType::MONDAY, EWSType_DayOfWeekType::WEDNESDAY, EWSType_DayOfWeekType::FRIDAY);
// Specify recurrence start and end
$request->Items->CalendarItem->Recurrence->EndDateRecurrence = new EWSType_EndDateRecurrenceRangeType();
$request->Items->CalendarItem->Recurrence->EndDateRecurrence->EndDate = '2014-05-30';
$request->Items->CalendarItem->Recurrence->EndDateRecurrence->StartDate = '2014-05-14';
Looks like you're just missing the DaysOfWeek array item. Adjust your array as needed based on the days you'd like the meeting to occur, and of course set your own start and end dates as well. I believe the Interval item would be equivalent to 1=every week, 2=every other week, etc. but i have not tested that.
I have the following code producing this error: Fatal error: Call to a member function setTimeZone() on a non-object in C:\wamp\www\grid2.php on line 58
I am trying to set up this function to take in a date string as below, apply the time offset, then output it back out in the format set up in the function call... but no luck.
<?php
if (!session_id()) session_start();
$_SESSION["timeoffset"] = "Europe/Amsterdam";
function formatDate($date, $format){
// use the the appropriate timezone for your stamp
$timestamp = DateTime::createFromFormat($format, $date, new DateTimeZone('UTC'));
// set it to whatever you want to convert it
$timestamp->setTimeZone(new DateTimeZone($_SESSION["timeoffset"]));
echo $timestamp->format($format);
}
formatDate('2012-10-14T21:15', 'Y-m-d\TH:i');
?>
I am also trying to figure out how return the string with a certain number of added minutes amount of minutes.
So the string "2012-10-14T21:15" would have 5 minutes added = "2012-10-14T21:20"
Any help would be greatly appreciated!
Jeff
DateTime::createFromFormat will return false on failure. This means that:
DateTime::createFromFormat($format, $date, new DateTimeZone('UTC'));
has failed and that $timestamp is false (var_dump($timestamp) will show you). Without knowing what you're passing in as your parameters for function formatDate, I don't think anyone will be able to figure out exactly what you're doing wrong.
Use this rather
$timestamp->setTimeZone(new DateTimeZone("Europe/Amsterdam"));
I think the sessions array isn't returning the string Europe/Amsterdam.
Do the debugging
public function updateAuction($id)
{
$AuctionsTable = Doctrine_Core::getTable('auctions');
$auction = $AuctionsTable->find($id);
$auction->ends_at += 10;
$auction->save();
}
I'm using Doctrine to get a record from the database.
I need to increase number of seconds on this records ends_at column, which is a date type.
+= of course didn't work. What is the quickest way to add, let's say, 10 seconds to ends_at variable? And having handled all the other nuisances that might appear (59 + 10 = 69 seconds).
Perhaps I should use mysql's addtime() function? But is that implemented with Doctrine? Didn't find anything about addtime() on doctrine.
Convert the value from the DB into a DateTime object in PHP
Use the DateTime::add function to add the seconds
Put the resulting value back into the DB
try this:
$sec = new Zend_Date($auction->ends_at, Zend_Date::SECOND);
$auction->ends_at = $sec->addSecond(10);
$auction->save();