Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Managing Date and Time in ActionScript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 604
    Comment on it

    Managing Date and Time in ActionScript is done using the DATE class. The Date class in actionscript provides you the information of date as well as the time. The Date function has a great importance in actionscript. For example if we want to calculate that how much time a user has spend on any particular screen then for that we can make use of the date class. Like the most of ActionScript3 Classes, before using the Date Class, you will have to create the object of it. We can do this by using the new keyword to create the date instance:

    var mydate:Date = new Date();
    

    Now if we want the date to be displayed we can use the trace( ) for that.

    var mydate:Date = new Date();
    trace(mydate);
    

    The following result will be displayed in the output window:

    alt text

    The date class also allows us to get the specific data like Month,Date,Hours,Minutes etc. This can be understood with the following examples:

    var mydate:Date = new Date();
    trace(mydate.hours);
    

    OUTPUT: Current hours in 24 hour format.

    var mydate:Date = new Date();
    trace(mydate.fullYear);
    

    OUTPUT: Display the current year.

    var mydate:Date = new Date();
    trace(mydate.month);
    

    OUTPUT: Display the month in numbers between 0 to 11.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: