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);
Related
I am sending a user provided date in the format MM/DD/YYYY. Example 10/07/2020. I want to store this date in a column of type TIMESTAMP(0) in an oracle database.
I have this in my code:
$medicalClaimDetail = new MedicalClaimDetail();
$medicalClaimDetail->TREATMENT_DATE = new yii\db\Expression('10/07/2020');
$medicalClaimDetail->save();
However I get this exception:
Error Code : 932 Error Message : ORA-00932: inconsistent datatypes: expected TIMESTAMP got NUMBER Position
using strings worked for me.
in db component config i had:
'on afterOpen' => function($event) {
$event->sender->createCommand("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'")->execute();
$event->sender->createCommand("ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'")->execute();
}
in code i set dates and timestamps as strings:
$medicalClaimDetail->TREATMENT_DATE = date('Y-m-d H:i:s', time());
$medicalClaimDetail->save();
I have this project in php in which my goal is to compare data from the database with some data I get from outlook, and if it's the same data i skip to the next row, otherwise I update.
The data in the DB comes like below:
$db = 'Meeting F2F Planung Meetings/Bilas 2018 2017-09-19 10:002017-09-19 12:0000KI Büro'
The data from outlook:
$outlook = 'Meeting F2F Planung Meetings/Bilas 2018<font size="2"><span style="font-size:10pt;"><div class="PlainText"> </div></span></font>2017-09-19 10:002017-09-19 12:0000KI Büro'
What i do is to get the data from outlook look like the one in DB is:
$outlook = (strip_tags(html_entity_decode($outlook)));
I still get the 'Büro' when I transfrom the data from outlook, so when i compare $outlook and $event, they appear as not equal so in my project it updates.
By asking here I got to the code above, but in this case it doesn't seem to work.
Try this
$outlook = utf8_decode(strip_tags(htmlspecialchars_decode($outlook)));
echo $outlook;
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.
I am current using CodeIgniter 2.2.2 and I have the following code inside my modal:
$this->createDate = time();
$this->db->insert('someDB_Table', $this);
Where my createDate type is a timestamp (i also tried datetime). But this is giving me all zeros when inserting inside DB. Is there other way to get around this? Like such: 0000-00-00 00:00:00
Try this(array input method)
$my_array = array(
'database_field' => $this->input->post('input_form_field'),
'time_stamp' => date('Y-m-d H:i:s'),
);
$this->db->insert('someDB_Table', $my_array);
I fixed the error:
this->createDate = date("Y-m-d H:i:s");
Apparently Datetime/Timestamp requires a format to be recognizes in time at insertion. So here you go!
It looks like your are storing the date inside the variable "createDate" which is stored in your structure variable $this. So it is quite the same as $this['createDate'] = time();
Try to do :
$this = time();
$this->db->insert('someDB_Table', $this);
or
$this->createDate = time();
$this->db->insert('someDB_Table', $this->createDate);
I haven't tested it but both of them should work. Also check your table column name (Sometimes bugs comes from that).
Otherwise this is how I do it almost every time:
$date = time();
$mysqli->query("INSERT INTO `someDB_Table`(`createDate`) VALUES (`$date`)");
Good luck ;)
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