NON RÉSOLU Display Date debut dd/mm/yyyy as yyyy
-
Bonjour,
I need your support regarding the following subject.
I need to display "Date debut" as Year ( 2020 / 2024 ).
I need to display the year instead of dd/mm/yyyy.I have created a new column with the following:
var dateDebut = values[27]; // Assuming values[27] contains a date string// Check if dateDebut is a valid date string
if (typeof dateDebut === 'string' && !isNaN(Date.parse(dateDebut))) {
var dateObject = new Date(dateDebut); // Convert to Date object
var year = dateObject.getFullYear(); // Extract the yearif (!isNaN(year)) { // Ensure the year is a valid number return new Date(year, 0).getTime() / 1000; // January is 0 } else { console.error("Invalid year extracted from date"); }
} else {
console.error("Invalid date string");
}but without any success.
please advice,
Merci
-
@madeleine a dit dans Display Date debut dd/mm/yyyy as yyyy :
eed to display "Date debut" as Year ( 202
Hi,
You don't have to create another column to display the year of the date. Make sur your column is qualified as time dimension. Then you just have to use the hierarchy 'Date' and the level 'Year'. It will extract the year from the date
-
Merci beaucoup!