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
28
votes
7answers
50k 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?
14
votes
2answers
6k 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:...
9
votes
3answers
22k 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')...
9
votes
2answers
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 ...
9
votes
3answers
7k 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
1answer
5k views

How to add a date field in system.xml?

How can I create a date field by using system.xml?
6
votes
4answers
26k 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?
6
votes
6answers
36k 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 ...
6
votes
2answers
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 (...
6
votes
0answers
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 ...
5
votes
4answers
3k 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.
5
votes
1answer
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('...
5
votes
2answers
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 ...
5
votes
2answers
4k 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
4answers
2k 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.
5
votes
1answer
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
votes
1answer
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
0answers
924 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 ...
4
votes
1answer
5k 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=...
4
votes
4answers
11k 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'); ...
4
votes
3answers
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 ...
4
votes
1answer
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
4answers
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 ...
4
votes
4answers
4k 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
2answers
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.
4
votes
1answer
679 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
6answers
17k 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->...
3
votes
2answers
762 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
1answer
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 ...
3
votes
2answers
2k 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 ...
3
votes
3answers
3k 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('...
3
votes
1answer
3k 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 ...
3
votes
0answers
110 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
1answer
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('...
2
votes
1answer
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 ...
2
votes
2answers
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->...
2
votes
2answers
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"><?...
2
votes
4answers
1k 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
4answers
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="<?...
2
votes
1answer
495 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
1answer
7k 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.
2
votes
1answer
3k 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
2answers
354 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'=&...
2
votes
3answers
113 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 ...
2
votes
1answer
191 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->...
2
votes
1answer
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 ...
2
votes
2answers
175 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?
2
votes
1answer
1k views

Magento2: Add date-from validation for dob (date of birth) field in customer creation

I want to limit the dob field in account creation form to be not less than 01/01/1900. I thought 2 way: - limit the calendar widget (but maybe someone could input the date directly) - add a ...
2
votes
2answers
2k views

Timer countdown in product view page

I want to display timer countdown in product view page. how to achieve this ?
2
votes
1answer
4k 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', '...

1
2 3 4 5