Solved

date/time comparison

Posted on 2007-03-28
2
210 Views
Last Modified: 2008-02-01
Hello.  I have a situation in flash 8 where i need my movie to show different things based on the time of day it is.  like from 12 AM to 3:59:59 PM i need it to show some things and from 4 PM to 11:59:59 PM i need it to show other things.  Can someone provide some AS that will get something like this done?  i realize it's based off of the users system time.  i'm not really concerned about the year/month/day.  just the hours, minutes and seconds of whatever day.

thanks!
0
Comment
Question by:linuxrox
2 Comments
 
LVL 2

Accepted Solution

by:
khoama earned 250 total points
ID: 18809199
var dDate:Date =new Date();

//get the current Date
dDate.getDate();

// 0 <= hh <=23
hh=dDate.getHours();

// 0 <= mm <=60
mm=dDate.getMinutes()

// 0 <= ss <=60
ss=dDate.getSeconds();

//do smthing here the time here
0
 
LVL 3

Assisted Solution

by:ieciep
ieciep earned 250 total points
ID: 18815181
the following code shows how you can compare time.

Hours value ranges from 0 - 23. Lemme know if you need the source file.

code info:
-----------
timeDisp is a movie clip symbol instance.

code:
------

var myDate:Date =new Date();
date=myDate.getDate();
hours=myDate.getHours();
mins=myDate.getMinutes();
secs=myDate.getSeconds();

if(hours>=6&&hours<16)//day
{
      timeDisp.gotoAndStop(1);
}
else if(hours>=16&&hours<20)//evening
{
      timeDisp.gotoAndStop(2);
}
else if(hours>=20&&hours<6)//night
{
      timeDisp.gotoAndStop(3);
}

Regards,
Riz
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to display a webpage in a flash 10 355
Youtube video error 30 738
YouTube video issue 28 110
Removing Flash from Website 6 45
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

3 Experts available now in Live!

Get 1:1 Help Now