Countdown to a specific time (Not Midnight)

Hello All;
I have to quickly make a countdown timer for a website that counts down to a specific date & time (Not midnight). I need like May 4th, 2011 at 9:10 AM.
I used a tutorial to create a timer that counts down to midnight but need to modify it to countdown to a specific time other than midnight.
Below is the code. Can anyone help me modify the code below. Thanks.
Tim
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var targetDate:Date = new Date(currentYear,1,12);
var targetTime = targetDate.getTime();
if (targetTime <= 0) {
  gotoAndStop(3);
var timeLeft = targetTime - currentTime;
var sec = Math.floor(timeLeft/1000);
var min = Math.floor(sec/60);
var hrs = Math.floor(min/60);
var days = Math.floor(hrs/24);
sec = String(sec % 60);
if (sec.length < 2) {
  sec = "0" + sec;
min = String(min % 60);
if (min.length < 2) {
  min = "0" + min;
hrs = String(hrs % 24);
if (hrs.length < 2) {
  hrs = "0" + hrs;
days = String(days);
var counter:String = days + ":" + hrs + ":" + min + ":" + sec;
time_txt.text = counter;

I haven't looked at the rest of the code, but if you say it works, then all you really need to do is adjust the targetDate arguments.
The constructor for a Date object is...
Date(year, month, date, hour, minute, second, millisecond)
so just fill in the data you need instead of what you have....
var targetDate:Date = new Date(year, month, date, hour, minute, second, millisecond);

Similar Messages

  • Reboot at a specific time not working in Yosemite?

    Since moving a couple of our servers to Yosemite I have been unable to get them to actually reboot at a specific time as requested via System Preferences > Energy Saver > Schedule.
    10.9 servers reboot on their own fine. 10.10 has required a manual reboot since installing it on two late silver model Mac Pros and on one Mac Mini Server.
    Ideas? Thanks.

    While in Time Machine, press the key combination shift-command-C. The front window will show all mounted volumes. All snapshots should now be accessible. Select the one you want and navigate to the files you want to restore.

  • Splitting rows at specific times (not intervals)

    Greetings.
    I have a data set with fields that hold start and end times for specific events. These events have unique ID's and cross multiple time intervals. I'm looking for a way to split a single row in the dataset into multiple rows with new start and end times for each relevant time interval.
    The examples I've found online describe ways (using the MODEL method) to split rows based on time intervals of a fixed length (24 hours, for example) but I'm looking for a way to split the records at a specific time (at 6am and 6pm.)
    So this record set:
    <tt>SELECT ID, START_DATE, END_DATE FROM EVENTTABLE
    _ ID __________ Start_date __________ End Date _____
    1228322 __ 21-NOV-11 17:51:29 __ 21-NOV-11 19:32:27
    1228327 __ 21-NOV-11 14:53:24 __ 22-NOV-11 03:46:06
    1228334 __ 21-NOV-11 03:32:53 __ 21-NOV-11 05:13:13
    1183267 __ 25-SEP-11 16:09:13 __ 27-SEP-11 04:38:11</tt>
    Would become:
    <tt>SELECT ID, START_DATE, END_DATE FROM EVENTTABLE MODEL...
    _ ID __________ Start_date __________ End Date _____
    1228322 __ 21-NOV-11 17:51:29 __ 21-NOV-11 18:00:00
    1228322 __ 21-NOV-11 18:00:00 __ 21-NOV-11 19:32:27
    1228327 __ 21-NOV-11 14:53:24 __ 21-NOV-11 18:00:00
    1228327 __ 21-NOV-11 18:00:00 __ 22-NOV-11 03:46:06
    1228334 __ 21-NOV-11 03:32:53 __ 21-NOV-11 05:13:13
    1183267 __ 25-SEP-11 16:09:13 __ 25-SEP-11 18:00:00
    1183267 __ 25-SEP-11 18:00:00 __ 26-SEP-11 06:00:00
    1183267 __ 26-SEP-11 06:00:00 __ 26-SEP-11 18:00:00
    1183267 __ 26-SEP-11 18:00:00 __ 27-SEP-11 04:38:11</tt>
    Notice that record 1183267 starts in one interval, crosses two whole intervals and ends in a fourth. This splitting of one event into many is required to create a record set that will guarantee a record for each of the relevant intervals.
    Thanks in advance for your consideration!

    SonyDADCuser wrote:
    Greetings.
    I have a data set with fields that hold start and end times for specific events. These events have unique ID's and cross multiple time intervals. I'm looking for a way to split a single row in the dataset into multiple rows with new start and end times for each relevant time interval.
    The examples I've found online describe ways (using the MODEL method) to split rows based on time intervals of a fixed length (24 hours, for example) but I'm looking for a way to split the records at a specific time (at 6am and 6pm.)
    So this record set:
    <tt>SELECT ID, START_DATE, END_DATE FROM EVENTTABLE
    _ ID __________ Start_date __________ End Date _____
    1228322 __ 21-NOV-11 17:51:29 __ 21-NOV-11 19:32:27
    1228327 __ 21-NOV-11 14:53:24 __ 22-NOV-11 03:46:06
    1228334 __ 21-NOV-11 03:32:53 __ 21-NOV-11 05:13:13
    1183267 __ 25-SEP-11 16:09:13 __ 27-SEP-11 04:38:11</tt>
    Would become:
    <tt>SELECT ID, START_DATE, END_DATE FROM EVENTTABLE MODEL...
    _ ID __________ Start_date __________ End Date _____
    1228322 __ 21-NOV-11 17:51:29 __ 21-NOV-11 18:00:00
    1228322 __ 21-NOV-11 18:00:00 __ 21-NOV-11 19:32:27
    1228327 __ 21-NOV-11 14:53:24 __ 21-NOV-11 18:00:00
    1228327 __ 21-NOV-11 18:00:00 __ 22-NOV-11 03:46:06
    1228334 __ 21-NOV-11 03:32:53 __ 21-NOV-11 05:13:13
    1183267 __ 25-SEP-11 16:09:13 __ 25-SEP-11 18:00:00
    1183267 __ 25-SEP-11 18:00:00 __ 26-SEP-11 06:00:00
    1183267 __ 26-SEP-11 06:00:00 __ 26-SEP-11 18:00:00
    1183267 __ 26-SEP-11 18:00:00 __ 27-SEP-11 04:38:11</tt>
    Notice that record 1183267 starts in one interval, crosses two whole intervals and ends in a fourth. This splitting of one event into many is required to create a record set that will guarantee a record for each of the relevant intervals.
    Thanks in advance for your consideration!Neat problem.
    This assumes you have a reasonably recent version of Oracle, and i only tested it for your "complex" case spanning multiple days because i didn't want to type out a bunch of sample data. Should work on all your data sets though (i always say this when i do incomplete testing :).
    with
      time_data as
      select
          1                                                         as col1
        , to_date('25-sep-2011 16:09:13', 'dd-mon-yyyy hh24:mi:ss') as start_date
        , to_date('27-sep-2011 4:38:11', 'dd-mon-yyyy hh24:mi:ss')  as end_date
      from dual
    select *
    from
      select
          col1
        , greatest
              trunc(t.start_date, 'dd') - interval '6' hour + (interval '12' hour * m.column_value)
            , t.start_date
          ) as start_date
        , least
              trunc(t.start_date, 'dd')  + interval '6' hour + (interval '12' hour * m.column_value)
            , t.end_date
          ) as end_date
      from time_data t,
        table(cast(multiset(select level from dual connect by level <= ceil(end_date - start_date) * 2) as sys.odcinumberlist)) m
    where start_date < end_date;

  • Flash Countdown Clock in Specific Time Zone?

    I am looking for a tutorial to make a countdown clock in
    Flash, with days, hours, minutes and seconds.
    Here's the tricky part: the countdown clock will be seen from
    multiple time zones.
    I have seen a couple of coutdown clock tutorials that assume
    that the time is based on the time from the user's computer clock.
    The event starts at 8 pm Central Time, but to users in Eastern
    Time, it will look like the event starts at 8 pm Eastern Time.
    What to do, what to do...

    You can use TIME ZONE statement for this.
    DATA: time_stamp_s TYPE string,
                time_stamp     TYPE timestamp,
                tzone              TYPE timezone,
               wf_date_conv TYPE sy-datum,
               wf_time_conv TYPE sy-uzeit.
    tzone = 'CET'.
    CONCATENATE sy-datlo   "Local Date
                              sy-timlo    "Local Time
                      INTO time_stamp_s.
    time_stamp = time_stamp_s.
    CONVERT TIME STAMP time_stamp TIME ZONE tzone INTO DATE wf_date_conv TIME wf_time_conv.
    Otherwise FM IB_CONVERT_INTO_TIMESTAMP/IB_CONVERT_FROM_TIMESTAMP can bne used for same.
    Edited by: Satyajit on Apr 13, 2010 1:31 PM

  • Events with specific time not showing on my ipad or iPhone... only on my iMAC... all day events show up

    When I look at my icloud calendar on my MAC, everything is there... when I go to my iPhone or iPad... the timed events are missing.  The all day events do show up?   HELP?

    Duplicates are due to syncing both with iCloud AND with iTunes.  Turn off calendar syncing in iTunes.
    I don't know what you mean by "removed some from my mibile devices".  Are you sayig some calendars are gone on some devices that have been registered with iCloud?

  • How to mask out specific area in a specific time?

    Hi,
    I want to make a mask on a specific area of the footage in a specific time. I drew the mask and all the frame went black,so I clicked on Mask-> invert and only the specific area I masked went black,which is exactly what I wanted.
    Now I want to make it happen in a specific time, not on all timeline, but I can't find a way to do it. I thought about lowering down the mask opacity to 0% and a frame later bringing it to 100%, but if I lower down the opacity of the mask, it lowers down the opacity of the whole frame, same as
    lowering down the opacity of the frame by intention, which seems weird, cause I did inverted the mask, and as I understand it, it should affect the opacity of the mask and not the whole frame...
    any ideas...?
    I'm using CS4.

    Put a copy of the footage on the timelime below the one you masked. Use opacity like you doing and it will reveal the track below.

  • Not getting Yahoo emails on Q5 except for a specific time span

    My Q5 started to have this issue started about 4, 5 days ago. I dont get any Yahoo emails except for an approx 5 hr time span at specific times of the day.  All other times I do not get any emails at all, not even when pressing the "refresh" icon.  
    I have deleted / rebooted/re-added the yahoo account multiple times without any improvement. I have also tested for improvement by taking away the "rim." in the settings (IMAP and SMPT), no help.
     Well, right after re-adding the acct, the missing emails showed up, but that was it.  It doesn't update my emails until that specific time of the day (for me that time span is from midnight to ~5am).  I'm able to send out email fine.  
    Anyone has any suggestions?
    Thank you very much in advance.

    Re: Yahoo.ca email account information disappears or is not recognized
    ‎11-25-2013 08:53 PM
    The password disappeared again, so I changed the password as you suggested.
    I discovered that Yahoo had changed the password requirements, and that was likely causing the problem.
    (I wish the error message had been more specific so I would have known that was the issue earlier).
    I created a new password according to the new Yahoo password requirements, and I have not had any other problems with it so far.
    Thanks.
    It was not me it was user cb_ca and the above is what they posted. You can ask that user your question, just click the envelope icon on the middle of the page near the top and you can send them a message, just enter the users name mentioned above and type your message.

  • Not able to jump to a specific time on a music track (time slider has disappeared!)

    I don't know how it happened (update of iOS version?) but the time indicator saying how far into the music track as well as the time slider allowing me to 'scratch' to a specific time have both disappeared.
    Only the volume slider remains! How can I reinstate the time feature?

    thanks... i suddenly feel rather silly. although i swear i tried everything previously and it didn't work. oh well.

  • Is there any way to have a message sent at a specific time?

    Greetings:
    I am trying to figure out if there is a way to send an email to someone (not my own address) at a specific time on a specific date? Essentially I want to compose the email but only have it sent at midnight on December 1.
    Thanks in advance.
    Jeff

    I don't think so, not in Mail.app. However, there is a group of apple scripts available known as "Mail Scripts 2.10" that has as one of the scripts a thing called "Schedule Delivery (Mail)." From the webpage, it states that this script "Allows you to send individual messages at predefined times (this script uses iCal for scheduling message delivery)." I've not personally used it so I'm not familiar with it, but this may be of interest to you.

  • How to address a specific time in VOD for iOS

    Using Flash and RTMP it's easy to go to a specific time in a VOD stream served from AMS using the seek method.
    Is there similar ability to seek to a specific time in VOD delivered to Safari on iOS?  The native video player provides a currentTime method, but I've not seen documentation anywhere to suggest currentTime or another method to provide rapid and accurate time based access from AMS.
    FWIW, Wowza documentation provides an answer:
    http://www.wowza.com/forums/content.php?326-How-to-specify-a-play-start-time-and-duration- for-HTTP-streaming
    TIA,
    RT

    Nitin, the link you provided is a bit better than nothing, but it refers to the AVPlayer object in applications, rather than iOS delivered data.  In our experience currentTime is a settable property for the native video player in mobile Safari, using a normal progressive uploaded stream, as the documentation shows:
    http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLMediaEle mentClassReference/HTMLMediaElement/HTMLMediaElement.html
    The question is "Are there browser based methods that seek AMS delivered streams more quickly or with better accuracy?" 
    Everyone is aware that mobile is exploding.  On some of our videocentric apps the share for iOS is approaching 20%.  PM Kevin Towes, what are you doing to accomodate this need???

  • How to automatically open and close an application at specific times?

    Hi,
    I am trying to figure out how to open and close an application at specific times.
    I have set iCal up to open it no problem...however, the application needs you to click yes before entering into it upon boot.
    How do I do this and close the app. I tried creating a workflow in automator, but iCal simply opens the workflow and does not play it. This also does not solve the issue of needing the 'yes' button to be clicked.
    Kind regards,

    Hi,
    I am trying to figure out how to open and close an application at specific times.
    I have set iCal up to open it no problem...however, the application needs you to click yes before entering into it upon boot.
    How do I do this and close the app. I tried creating a workflow in automator, but iCal simply opens the workflow and does not play it. This also does not solve the issue of needing the 'yes' button to be clicked.
    Kind regards,

  • Is there a way to create a smart playlist that lists my top 25 plays from a specific time period (i.e. - top plays from the last 90 days)?

    Is it possible to create an itunes smart playlist that lists my top 25 most played songs in a specific time period (i.e. - the last 90 days)?  It seems that any "most played" list I create counts every spin a track has had in it's history of being in my library. 

    The challenge is is not to determine which of the tracks that have been played in the last X days has been played most since the beginning of time, but which have been played most in the last X days. iTunes can do the first one but it simply doesn't have the power to do the second.
    tt2

  • In setting up my ICal calendar I have specific times (as new events) that I want to be included in the print out.  This doesn't happen.

    In setting up my ICAL calendar I have specific times (as new events) for each day.  When it prints out the time does not show up (rather its a bar).  I would like the time for each appointment to print out. How do I do this?

    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    Note if you have failed to move contacts and calendar items across you should create one dummy entry of each in your new profile and iTunes should  merge the existing data from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library or a backup then then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data.
    tt2

  • How do you set a calendar alarm for a specific time on the day of the event without it being an all-day event

    Does anyone know how to set a calendar alert at a specific time on the day of the event.
    So that the alert date adjusts accordingly if you were to copy and past it to another date.
    The custom alert function kind of does this, but because it is an absolute alert (not relative) it will still refer to the date you initially set it to when you copy and paste it to another date. So this creates more work where you would have to go and manually change all the custom alerts. I have potential
    Anyone know how to set this kind of calendar alert?
    Thanks in advance

    Greetings: Set the alarm to message you (on your screen) and then snooze it every day for 15 days, or, set 15 separate alarm messages. There is probably an AppleScript somewhere on the web too, try searching that way as well.

  • Call contact at a specific time

    Hello, is it possible to to make a calender-entry to call a contact at a specific time and when remembered by the calender-notification to perform the call out of the calenderapp-note?

    No, it is not.

Maybe you are looking for