RO CSVI

Date and Custom date in Multi replace plugin

Most of the times we would need to export or import today's date or a custom format date in our export and import operations. This can be now be easily accompolished using RO CSVI Multi replace rule plugin. 

Date format on export

The example here explains on how to create a rule in Multi replace plugin for exporting today's date in your exports, the same can be followed for import too.

  1. Create a new Multi replace rule for export
  2. Select Operation as Date
  3. Under Filter section and Date format field enter the format you want to export date, for example like d-m-Y. Check for other date formats with PHP date documentation
  4. Save the rule
  5. Apply the rule on your export template fields.

csvi multireplace rule date export

Running an export by setting Today's date export on custom template field, an example in export file will look like below

csvi multireplace rule date export example

Date format on import

An example for import using date format for field created_on in VirtueMart Product import is explained below.

1. Create VirtueMart Product import template and add created_on as one of the field in import

2. This is the preview page before applying the date rule.

csvi multireplace before date rule applied

3. Now create  a rule using Multi replace plugin with date as operation. Add a date format to the rule. 

csvi multireplace date import rule

4. Apply the rule on created_on field

csvi multireplace date import createrule

5. Run the import and check the preview page. 

csvi multireplace date import preview

Custom date format

It is sometimes needed to change the date format you need to import or export from or to database. Custom date format operation in RO CSVI Multi replace plugin will help you with this. The below example explains changing date format for export, the same can be followed for import too.

Custom date format for export

  1. Create a new Multi replace rule for export
  2. Select Operation as Custom date format
  3. Under Filter section and Date format field enter the format you want to change the date to, for example like m.d.y
  4. Save the rule
  5. Apply the rule on your export template fields.

The default date format stored in database is Y-m-d H:i:s where Y is the year, m is the month, d is the date, H is the hour, i is the minutes and s is the seconds.  You can change this default format to any needed custom format in your export and in import you can change the date format in your import file to database supported format. Check for other date formats with PHP date documentation

csvi multireplace rule custom date export

An example export file created by applying Custom date format rule on created_on field in VirtueMart product export is shown below

csvi multireplace rule custom date example

Custom date format for import

 Here in this example we are explaining about using custom date format to change the format of created_on date on VirtueMart product import to database supported format Y-m-d H:i:s. 

1. Create a rule using Multi replace plugin

csvi multireplace custom date import rule

2. Create VirtueMart Product import template and add created_on as a template field. Apply custom date rule on created_on field.

csvi multireplace custom date import templatefields

3. Run the import and check the preview page.

csvi multireplace custom date preview

More articles on this subject