Animation

  1. Home
  2. Computing & Technology
  3. Animation

ActionScripting Basics: Basic Date Functions

By Adrien-Luc Sanders, About.com

6 of 8

Now, things start to get a little jumbled. I’ll give you the full code first, and then break it down:

stop() ;
today = new Date() ;
dateTextField = ((today.getMonth() + 1) + "/" + today.getDate() + "/" + today.getFullYear()) ;
_root.textdisplay.text="Today's date: "+dateTextField;

Got it? No? That’s okay; let’s tackle it bit-by-bit, starting with the dateTextField = ((today.getMonth() + 1) + "/" + today.getDate() + "/" +
today.getFullYear()) ;
line.

dateTextField is a variable that I’ve made up to encompass the value returned by the date functions. Basically all of these functions strung together will create a value, represented by that single word. dateTextField=today’s date, essentially.

getMonth checks the system date and retrieves the value of the current month; getDate checks the system date and retrieves the value of the current day as an integer; getFullYear checks the system date and retrieves the value of the current year in four-digit format.

Explore Animation

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Animation

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. ActionScripting Basics: Basic Date Functions

©2009 About.com, a part of The New York Times Company.

All rights reserved.