Questions tagged [date]

A date is a reference to a particular day represented within a calendar system, and consists of year, month and day.

Filter by
Sorted by
Tagged with
31 votes
7 answers
65k views

Magento 2 Get Current Store Date Time

In Magento 1.x you could get the store date time via Mage::getModel('core/date')->gmtDate(); What would be the equivalent to this in Magento 2.x?
  • 2,052
14 votes
2 answers
7k views

How to change date format of magento 2 admin grid filter without using ui component?

Below is some_grid_block.xml , How can I change date format in calendar filter. <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
  • 141
9 votes
3 answers
24k views

Magento Filter collection by create times (today, yesterday, week, hour etc)

I have a custom collection that I wish to filter by created date and het entries created "yesterday" Collection Entries //dates are set in controller using setCreatedTime(Mage::getModel('core/date')...
  • 814
9 votes
2 answers
12k views

How to let user choose delivery date?

My website is gifting website so I need to let users select the date of delivery. I want that selection (textbox with calendar popup) on shipping details step. I can google for a free extension but I ...
  • 325
9 votes
3 answers
9k views

Magento 2 - Best practice to get current date

I have to save an updated_at attribute of a custom entity and to know which is the best practice I took a look at how Magento 2 handles it. I looked at the \Magento\Eav\Model\Entity\Attribute\Backend\...
8 votes
1 answer
5k views

How to add a date field in system.xml?

How can I create a date field by using system.xml?
  • 9,885
7 votes
4 answers
40k views

Magento 2: How to get current date, date time with format in .phtml file?

I already referred Magento 2 Get Current Store Date Time But how to use directly in .phtml file? Can able to get Date, DateTime & Also able to set it's format?
  • 9,691
6 votes
6 answers
39k views

Get current date time used in magento for saving data

I want to get current date time which is magento used for save data into database. I searched and get this line of code, Mage::getModel('core/date')->date('Y-m-d H:i:s'); but this is not working ...
  • 783
6 votes
2 answers
2k views

Customer created / logged in timestamps in Admin

Over the weekend (2014-10-04 midnight through 2014-10-06 noon) I noticed that the customer created and last logged in dates were incorrect in the Admin. Last Logged In: Oct 6, 8295 10:12:43 AM (...
  • 2,695
6 votes
0 answers
1k views

Magento 2: Get Order Information Outside Magento Issue for Date

I have below script, trying to get all Orders. I have issue with Date. That i have solved using https://github.com/magento/magento2/issues/7560 //place this before any script you want to calculate ...
  • 9,691
5 votes
4 answers
4k views

How do I create date input field with calendar in Magneto2? [SOLVED]

I want to create a date input field with calendar control where I can change year and month by drop down.
  • 3,086
5 votes
1 answer
5k views

Admin form save date format, month and day wrong way around

I have created a new custom form/grid with a date field, I've also set up a table with the 'date' field to match. $this->addColumn('date', array( 'header' => Mage::helper('...
  • 682
5 votes
2 answers
6k views

Customer created_at Date off by months

I'm working on syncing my customers with a third party application and have discovered that many of my created_at dates are way off. Today is 2014-04-08 yet I have several records with a created_at ...
  • 223
5 votes
4 answers
3k views

Datepicker in widget

What is the best way to create widget with a parameter with date picker? The problem is that I did not find a good way to supply format value to Date element class.
  • 966
5 votes
2 answers
5k views

Adminhtml form date input type default format wrong

I've managed to create an Adminhtml form extending \Magento\Backend\Block\Widget\Form\Generic. I've added each field inside _prepareForm() method using $fieldset->addField() method. One of the ...
5 votes
1 answer
2k views

Magento checking order updated_at using Magento date and time

we are trying to filter out orders that were created longer than 60 minutes ago with status pending. We are having some problems with the date/time functions We tried: - date('Y-m-d H:m:s') and ...
  • 5,342
5 votes
1 answer
2k views

Add Date Picker and/or Validation To System Config Form Field Array

I'm building a module to handle business hours for a physical retail store. The idea is to have configurable fields for the business hours on each day of the week so they can be changed seasonally. ...
5 votes
0 answers
965 views

CE 1.9.2 - Date of Birth validation at checkout not working [closed]

I cannot for the life of me understand what is happening with the Date of Birth field in Checkout or Registration. I've set it as Required under Customer Configuration, and have the date fields order ...
  • 619
4 votes
1 answer
7k views

Date field system.xml

I wonder what 'date' type needs in system.xml. I keep getting the error : system.xml (only the field): <field id="date" translate="label" type="date" sortOrder="2" showInDefault="1" showInWebsite=...
  • 2,407
4 votes
4 answers
12k views

How to add 7 days to current date?

I need to save to db current date & "current date + 7days" values. For this I'm using following function. But how to add 7 days to this. Mage::getModel('core/date')->date('Y-m-d H:i:s'); ...
  • 227
4 votes
3 answers
2k views

Magento 2: How to use Zend Date

In Magento 1 we are using zend_date in a following manner new Zend_Date(date, 'MM-dd-Y'); or new Zend_Date(date('M-01-Y', strtotime("+1 months", strtotime(date("Y-m-d"))))); But how can I use ...
  • 379
4 votes
4 answers
7k views

Show product only within a date range (between start date and end date)

I want to create a product with start date and end date. Once the end date comes the product should be hidden from the product listing. Are there any methods to complete this task? I tried with ...
  • 2,661
4 votes
1 answer
7k views

Set created_at when programatically creating a Magento order

I'm struggling to set the order date when creating a magento order programatically. Here is what I'm trying to use: $orderObj->setData('created_at', $date); $orderObj->setUpdatedAt($date); but it ...
4 votes
2 answers
3k views

Magento 2 set created time and updated time in database

I am using php function now() to set current date and time.But getting an error. So please help me how can I set current date time in magento 2.
  • 379
4 votes
6 answers
6k views

Magento 2.1: Product date validation prevents saving "Make sure the To Date is later than or the same as the From Date."

Version: Magento 2.1 I cannot update or save a product due to this validation message: Make sure the To Date is later than or the same as the From Date. I assume it is referring to "Set Product ...
4 votes
1 answer
829 views

Magento 2 inline edit date issues

In magento2 Inline Edit date issues while i edit the record it display current date instead of my date My Ui component <!-- Date Column --> <column name="date" class="Magento\Ui\...
3 votes
6 answers
19k views

Change date format

I use a plugin that shows me list of posts and I want to change format of date. This is show me date like this: 24 january 2015 12:20:11 and this is the code of above output: <?php echo $post->...
  • 605
3 votes
2 answers
3k views

Add Custom Product Grid Created Date And Created By Magento 2

In magento 2 admin panel, at product list grid area, i want to add one more grid with date, that date define product create date. so we get idea at which time product was created. And i also want to ...
  • 387
3 votes
2 answers
853 views

How to change magento date/time

I am working on a magento custom module , and trying to test if the emails are sent properly , the module sends emails after 48 hours of an event , how do i modify the magento date time to test if ...
3 votes
1 answer
6k views

Problems with DateTime: failed to parse time string

I'm getting very confused here. I made a module which has an adminhtml form which contains a date field. I'm adding it like this: $quotaFieldset->addField( 'quota_expiry', '...
  • 713
3 votes
1 answer
8k views

Magento 2 : How to change default date format every where in magento?

I want to change the default date format like mm/dd/yy to dd/mm/yy for en_us locale in admin as well as front-end. Don't want to change the locale for that.
3 votes
3 answers
5k views

Magento 2: Filter Field with Date Issue

I have below code $updatedAtFrom = date("Y-m-d",strtotime($updatedAt['orig_from'])); $updatedAtTo = date("Y-m-d",strtotime($updatedAt['orig_to'])); $this->getCollection()->addFieldToFilter('...
  • 9,691
3 votes
1 answer
2k views

Sort Products by Date in Admin

Often we need to sort products in the admin on creation date. I know I can sort on ID, and this way I'll get the products in the this order, and I found some (free) extensions that give me the option ...
  • 73
3 votes
1 answer
4k views

How to change date format for Order Invoices In Magento 2

I want to change the date format for admin in Sales->Order(view order)->Invoices tab in 24H format I tried to find how this grid is rendered and i found(with template path hinth) that this table is ...
  • 2,632
3 votes
0 answers
119 views

Date format in the customer account dashboard

The date in the customer account dashboard in my Magento store is in the format of mm/dd/yyyy now, that is the date in the recent orders list is in above format. I want it to be displayed in the ...
3 votes
1 answer
1k views

How to solve date and time problem in magento? [closed]

I am using datepicker in magento form This is my code: $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); $fieldset->addField('...
  • 5,091
2 votes
1 answer
10k views

How to add date filter to product collection

I was wondering if there is any way to add a date filter to a product collection. What i am trying to do: I have a collection for new products, i need to add a filter to it so it filter the products ...
  • 137
2 votes
2 answers
8k views

Magento Adminhtml date picker on custom page (non-form)

I'd like to add a date picker to a custom input field on a .phtml. file which is loaded by Block reference, i.e: Controller public function indexAction() { $this->loadLayout(); $this->...
  • 7,495
2 votes
2 answers
2k views

Translate $date into Dutch

I want to translate the displayed date into Dutch. My current code looks like this: <?php $post = $this->getPost(); $date = Mage::getModel('core/date'); ?> <span class="date"><?...
  • 1,522
2 votes
3 answers
3k views

'No date part in '' found. when upgrading from Magento 1.9.0.x to 1.9.2.2

I have recently done an upgrade to a currently live and active Magento store from 1.9.0.x to 1.9.2.2 and when attempting to add a customer via the front end registration form or accessing customer ...
2 votes
4 answers
2k views

Filter magento Orders by From & To Date in custom page

magento site : www.1234.com we are displaying all the orders in page : www.1234.com/php/site6/date.php , user can able to see all orders only when user login to date.php page. in date.php page, ...
2 votes
4 answers
5k views

Magento registration date of birth in one field

I want that in my customer regitration form date of birth field to be in one field. Now it's in 3 fields. So I have <div class="input-box customer-dob"> <input type="text" id="<?...
  • 237
2 votes
1 answer
524 views

Magento : Catalog Price Rule Date Not Working Properly

I want to give some discounts for some products. Discount should start from a certain date, let's say 20/04/2017. This date is working fine if I use special price field in product management. But ...
2 votes
1 answer
4k views

Disable future dates in magento datepicker

I am using magento datepicker. i have an array dates which i want to disable that days in the magento datepicked. for example 08/29/14 is holiday. so i want to make the date as disable so the user ...
2 votes
2 answers
368 views

Grid date column js error

I added a date type column in a custom grid. $this->addColumn('some_date', array( 'header'=> Mage::helper('helper_alias')->__('Some Date'), 'index' => 'some_date', 'type'=&...
  • 196k
2 votes
3 answers
305 views

M2 - Change end date of all coupon codes

In the database there is a table called salesrule_coupon which has all the coupon codes in it. I need to change the column expiration_date for all the coupons to the same date 30-08-2024, Is This ...
  • 613
2 votes
1 answer
583 views

Set expiry date and save value in table magento 2?

I want to set expiry date for let say store credit, I have created custom column by installschema in table as: { $table = $setup->getConnection()->addColumn( $setup->...
  • 1,581
2 votes
1 answer
3k views

Date Validation not working ( conflict with Date Picker )

Following issue wiht 1.8 CE: When I’m trying to save CMS custom design info: Custom Design From Custom Design To The validation fails ( even if dates are correct ) I’m trying with chrome I have ...
  • 6,935
2 votes
2 answers
1k views

Magento 2 - Admin grid and export use different timezone

I'm using Magento 2. So, I created a Adminhtml data grid in a custom module. The problem is that the data grid doesn't match the exported data. I've set the timezone, but it seems data grid and ...
2 votes
2 answers
589 views

How to over ride php file in magento 2.3

I want to do some changes in vendor/magento/framework/Stdlib/DateTime/Date.php How can I override the file in app folder?
  • 720

1
2 3 4 5