Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Piccola modifica script

    Ho trovato in rete questo script per visualizzare giorno e data ma mi servirebbe poter togliere l'ora, quindi vorrei che rimanesse solo giorno data e anno. Mi rivolgo a voi perchè di javascript purtroppo ncapisco pochissimo

    Vi posto lo script:

    <script language="" class="normale">
    <!--
    var days=new Array(8);
    days[1] = "Domenica";
    days[2] = "Lunedi;";
    days[3] = "Martedi;";
    days[4] = "Mercoledi;";
    days[5] = "Giovedi;";
    days[6] = "Venerdi;";
    days[7] = "Sabato";
    var months=new Array(13);
    months[1] = "Gennaio";
    months[2] = "Febbraio";
    months[3] = "Marzo";
    months[4] = "Aprile";
    months[5] = "Maggio";
    months[6] = "Giugno";
    months[7] = "Luglio";
    months[8] = "Agosto";
    months[9] = "Settembre";
    months[10] = "Ottobre";
    months[11] = "Novembre";
    months[12] = "Dicembre";
    var dateObj=new Date();
    var wday=days[dateObj.getDay() + 1];
    var lmonth=months[dateObj.getMonth() + 1];
    var date=dateObj.getDate();
    var anno=dateObj.getYear();
    var ora;
    var min;
    min = dateObj.getMinutes();
    if (min < 10)
    min = "0" + min;
    ora=dateObj.getHours() + ":" + min;

    if (navigator.appName == "Microsoft Internet Explorer")
    {
    if (anno > 99)
    {
    document.writeln(wday + " " + date + " " + lmonth + " " +anno + " " + ' Ore ' + ora);
    }
    else
    {
    document.writeln(wday + " " + date + " " + lmonth + " 19" +anno + " " + ' Ore ' + ora);
    }
    }
    else
    {
    if (anno > 99)
    {
    document.writeln(wday + " " + date + " " + lmonth + " " +(anno+1900) + " " + ' Ore ' + ora);
    }
    else
    {
    document.writeln(wday + " " + date + " " + lmonth + " 19" +anno + " " + ' Ore ' + ora);
    }
    }

    // -->
    </script>

    Grazie ciao

  2. #2
    Reale_Augello
    Guest

    Prova...

    ... così:

    codice:
    <script language="" class="normale"> 
    <!-- 
    var days=new Array(8); 
    days[1] = "Domenica"; 
    days[2] = "Lunedi;"; 
    days[3] = "Martedi;"; 
    days[4] = "Mercoledi;"; 
    days[5] = "Giovedi;"; 
    days[6] = "Venerdi;"; 
    days[7] = "Sabato"; 
    var months=new Array(13); 
    months[1] = "Gennaio"; 
    months[2] = "Febbraio"; 
    months[3] = "Marzo"; 
    months[4] = "Aprile"; 
    months[5] = "Maggio"; 
    months[6] = "Giugno"; 
    months[7] = "Luglio"; 
    months[8] = "Agosto"; 
    months[9] = "Settembre"; 
    months[10] = "Ottobre"; 
    months[11] = "Novembre"; 
    months[12] = "Dicembre"; 
    var dateObj=new Date(); 
    var wday=days[dateObj.getDay() + 1]; 
    var lmonth=months[dateObj.getMonth() + 1]; 
    var date=dateObj.getDate(); 
    var anno=dateObj.getYear();
    
    if (navigator.appName == "Microsoft Internet Explorer") 
    { 
    if (anno > 99) 
    { 
    document.writeln(wday + " " + date + " " + lmonth + " " +anno); 
    } 
    else 
    { 
    document.writeln(wday + " " + date + " " + lmonth + " 19" +anno); 
    } 
    } 
    else 
    { 
    if (anno > 99) 
    { 
    document.writeln(wday + " " + date + " " + lmonth + " " +(anno+1900)); 
    } 
    else 
    { 
    document.writeln(wday + " " + date + " " + lmonth + " 19" +anno); 
    } 
    } 
    
    // --> 
    </script>
    Ciao !

  3. #3
    Ok funziona benissimo, grazie 1000

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.