Solved

date/time comparison

Posted on 2007-03-28
2
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

752 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