Navigation

    Communauté Digdash

    • S'inscrire
    • Se connecter
    • Recherche
    • Catégories
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    NON RÉSOLU Display Date debut dd/mm/yyyy as yyyy

    Studio
    2
    3
    91
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • M
      Madeleine dernière édition par

      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.

      dfb4c654-a122-4e1e-8400-3a078cd9373c-image.png

      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 year

      if (!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

      GregoryBiraud 1 réponse Dernière réponse Répondre Citer 0
      • GregoryBiraud
        GregoryBiraud Expert DigDash @Madeleine dernière édition par

        @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

        Grégory Biraud

        M 1 réponse Dernière réponse Répondre Citer 0
        • M
          Madeleine @GregoryBiraud dernière édition par

          @gregorybiraud

          Merci beaucoup!

          1 réponse Dernière réponse Répondre Citer 0
          • 1 / 1
          • Premier message
            Dernier message
          • Accueil
          • Webinaires
          • Documentation
          • Interviews
          • Vidéos tutos