As of May 31, 2023, we have updated our Code of Conduct.

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
66k 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?
Eirik's user avatar
  • 2,072
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:...
Jamshe's user avatar
  • 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')...
BENN1TH's user avatar
  • 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 ...
Moe Sweet's user avatar
  • 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\...
Alessandro Ronchi's user avatar
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?
Sukeshini's user avatar
  • 9,895
7 votes
4 answers
42k 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?
Jackson's user avatar
  • 9,749
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 ...
Mathew's user avatar
  • 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 (...
Laura's user avatar
  • 2,690
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 ...
Jackson's user avatar
  • 9,749
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.
Manish's user avatar
  • 3,096
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('...
Typhado's user avatar
  • 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 ...
TimSum's user avatar
  • 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.
LDusan's user avatar
  • 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 ...
magento2-frustrations's user avatar
5 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 ...
Tim Semple's user avatar
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 ...
snh_nl's user avatar
  • 5,392
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. ...
Zeke Farwell's user avatar
5 votes
0 answers
967 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 ...
maGz's user avatar
  • 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=...
CompactCode's user avatar
  • 2,427
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'); ...
sivakumar's user avatar
  • 237
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 ...
Krupali's user avatar
  • 379
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 ...
jebarius's user avatar
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.
Krupali's user avatar
  • 379
4 votes
1 answer
846 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\...
Ankur Bhadania's user avatar
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->...
Elham Gdz's user avatar
  • 605
3 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 ...
Mujahidh's user avatar
  • 2,651
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 ...
JACK's user avatar
  • 387
3 votes
2 answers
885 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 ...
Malek Massoudi's user avatar
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', '...
peedee's user avatar
  • 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.
Ashish Jagnani's user avatar
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('...
Jackson's user avatar
  • 9,749
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 ...
Lucky's user avatar
  • 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 ...
Alin Lupoiu's user avatar
  • 2,642
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 ...
Akshay Vasu's user avatar
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('...
ND17's user avatar
  • 5,121
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 ...
Ylli's user avatar
  • 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->...
Moose's user avatar
  • 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"><?...
JGeer's user avatar
  • 1,446
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 ...
ChrisBratherton's user avatar
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, ...
Baby in Magento's user avatar
2 votes
4 answers
6k 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="<?...
Felix's user avatar
  • 237
2 votes
1 answer
528 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 ...
Magento Learner's user avatar
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 ...
Pradeep Sanku's user avatar
2 votes
2 answers
369 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'=&...
Marius's user avatar
  • 197k
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 ...
user7414328's user avatar
2 votes
3 answers
352 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 ...
n00bly's user avatar
  • 623
2 votes
1 answer
634 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->...
Ajwad Syed's user avatar
  • 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 ...
Fra's user avatar
  • 6,945
2 votes
2 answers
659 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?
Nafsss's user avatar
  • 720

1
2 3 4 5