• home
  • forum
  • my
  • kt
  • download
  • Display the date and time

    Author: 2008-10-09 08:51:43 From:

    First of all create a new dynamic text box, for more info see basic variables, and change the var: value to datedisplay. Once this is done, add the following code into the frame actions.

    datedisplay = new Date();
    weekday = new Array(”Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”);
    month = new Array(”January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”);
    datedisplay = (weekday[datedisplay.getDay()]+” “+datedisplay.getDate()+” “+month[datedispay.getMonth()]+” “+datedisplay.getFullYear());

    This will display the date in Monday 15 July format. To show it in other formats, swap or remove the pieces between the +’s

    Display the time

    This time create a dynamic text box and set the var: value to timedisplay. Then add the following into the frame actions.

    timedisplay = new Date();
    var hours = timedisplay.getHours()>9 ? timedisplay.getHours() : “0″+timedisplay.getHours();
    var minutes = timedisplay.getMinutes()>9 ? timedisplay.getMinutes() : “0″+timedisplay.getMinutes();
    var seconds = timedisplay.getSeconds()>9 ? timedisplay.getSeconds() : “0″+timedisplay.getSeconds();
    timedisplay = (hours + ” . ” + minutes + ” : ” + seconds);

    This will display the time as Hour:Minute:Seconds. You can play about with this line to change what you display in your time box.

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (112)
      Backend (25)
      Text Effects (65)
      Drawing (18)
      Tips and Techniques (41)
      Dynamic Content (31)
      Tricks (8)
      Games (97)
      Utilities (21)
      Getting Started (91)
      Video (24)
      Interactivity (43)
      Web Design (29)

    New

    Hot