How change date in footer, insert only year - twig

Opencart 3x How change date in footer, insert only years (html or javascript), no text ! (language/en-en/common/footer.php - $_['text_powered'] )

The real plece where the date implements in OpenCart 3 footer is in
catalog/controller/common/footer.php
$data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time()));
This one is date
date('Y', time())
You can change 'Y' as you want using PHP date formats.
Also you can put current date directly to your footer.twig.
{{ "now"|date('d-m-Y H:i') }}

Related

using format_datetime filter in twig

I show on a page a list of dates in french format.
I want to show date in french like this : "Janvier 2022".
The date stored in database is "2022-01-01".
Twig code :
{{ someDate | format_datetime(locale='fr', pattern="MMMM Y") | capitalize }}
Problem : it's showing "Janvier 2021", not "2022".
But the next date is correct, "FĂ©vrier 2022".
I don't understand why the year is 2021 and not 2022.
Please help !!
The week does not start the same day in France as in other countries
For year, use yyyy instead YYYY.
More information : Date format return wrong year in PHP with DateFmt in French

Excel VBA to web form date format

Doing my first VBA to fill in a web form in IE. Having some issue with date from excel changing format when it is put in the web field.
Set doc = ie.document
doc.getElementById("txtTrackNotes").Value = ThisWorkbook.Sheets("Sheet1").Range("B2").Value
doc.getElementById("txtEntryTrackConnote").Value = ThisWorkbook.Sheets("Sheet1").Range("A2").Value
doc.getElementById("txtTrackDate").Value = ThisWorkbook.Sheets("Sheet1").Range("C2").Value
The last line there is the one causing problem. The Value in C2 is a date in the format dd/mm/yyyy
When it goes into the webform it comes up in the format dd MONTH (in text) yyyy 00:00 (for example 1 January 2018 00:00)
Source HTML is
<input name="txtTrackDate" class="Size9" id="txtTrackDate" style="width: 100px;" onclick="javascript:displayDatePicker('txtTrackDate');" onblur="javascript:CheckDate(this.value);" type="text" value="25/10/2018">
Any suggestions would be greatly appreciated
Try
=Format$(ThisWorkbook.Sheets("Sheet1").Range("C2").Value,"dd/mm/yyyy")
Is the field expecting this input format? If the above still changes then verify what the expected format is for the field.

Talend- Empty string handling when parsing dates using tmap component

I have a job that loads a CSV into a MySQL table. The field I am paring to a date using the t-map component has empty strings for a few of the records. When parsing the string to date, I need to convert those empty strings to the current date. I've tried this expression in the tmap component with no luck. My field name is "Payroll_Pay_Date" Here is the expression:
row1.Payroll_Pay_Date equals("")?TalendDate.getCurrentDate():TalendDate.parseDate("MM/dd/yyyy",row1.Payroll_Pay_date)
I've tried several itterations of this. Actually, what I really want to is to have the empty string be replaced with the "current date - 7 days" but I figure I would start with the above. Any advice would be much appreciated.
You could do this:
row1.Payroll_Pay_Date == null || row1.Payroll_Pay_Date.trim().isEmpty() ? TalendDate.getCurrentDate() : TalendDate.parseDate("MM/dd/yyyy",row1.Payroll_Pay_date)
Here I first test if the string is null or if it's empty or containing only whitespaces, in which case I return the current date. Otherwise I parse the date.
To get the current date minus 7 days, you could do:
TalendDate.addDate(TalendDate.getCurrentDate(), -7, "dd")

Formatting magento timestamp to readable excel format

I download invoice reports from my magento website. They hold a date format I am not able to change to a standard date format. This is what it looks like: 1 aug. 2016 15:24:08
What formula can I use to have excel change it to a format like 13-08-16 (Dutch Format) ( I don't need the time for the moment).
Assuming that your 3 letter month names end with a dot in magneto data, you can use this where original data is in cell A1
=TEXT(SUBSTITUTE(LEFT(A1,FIND(".",A1)+5),".",""),"dd-mm-yy")
Check if "1 aug. 2016 15:24:08" is:
a\ pure string (String Type data; "wroted" date)
or
b\ string representation of Date type data (formatted date)
.

Rearranging the content of a cell in Cognos 10

I've got birthdays as a varchar formatted as dd-mm-yyyy and I'm trying to build a filter that shows only the birthdates of the last 7 days.
Now normally I'd convert that field to a date field, but since it contains dummy values this isn't an option.
So I want to change the output to YYYYMMDD so I can use the value in a => filter.
How can I do this?
If you want the result in string format:
substring([Date],7) || substring([Date],4,2) || substring([Date],1,2)
..or in integer format:
cast(substring([Date],7),integer) * 10000 + cast(substring([Date],4,2),integer) * 100 + cast(substring([Date],1,2),integer)

Resources