8 Replies Latest reply on Sep 1, 2010 4:46 PM by iceministries

    Can Military Time be reset to Regular time in Flash File?

    iceministries

      I am working on a site that has a clock but it displays in military time, is there a way to change it to regular time.

      The following is the Action script:

      months_array = ["JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMPBER", "OKTOBER", "NOVEMBER", "DECEMBER"];
      days_array = ["MON", "TUE", "WED", "THUR", "FRI", "SAT", "SUN"];
      date = new Date();
      var dayOfWeek_array = new Array("SUN", "MON", "TUE", "WED", "THUR", "FRI", "SAT");
      var today_date = new Date();
      var day_str = dayOfWeek_array[today_date.getDay()];
      F_clock = function ()
      {
      var _loc1 = new Date();
      var _loc4;
      var _loc3;
      var _loc2;
      if (_loc1.getSeconds() < 10)
      {
      _loc4 = "0" + _loc1.getSeconds();
      }
      else
      {
      _loc4 = _loc1.getSeconds();
      } // end else if
      if (_loc1.getMinutes() < 10)
      {
      _loc3 = "0" + _loc1.getMinutes();
      }
      else
      {
      _loc3 = _loc1.getMinutes();
      } // end else if
      if (_loc1.getHours() < 10)
      {
      _loc2 = "0" + _loc1.getHours();
      }
      else
      {
      _loc2 = _loc1.getHours();
      } // end else if
      if (_loc1.getHours() < 12)
      {
      _loc2 = _loc1.getHours();
      }
      else
      {
      _loc2 = _loc1.getHours() - 12;
      } // end else if
      if (hours >= 12)
      {
      hours = hours - 12;
      ampm = "PM";
      }
      else
      {
      ampm = "AM";
      } // end else if
      if (hours == 0)
      {
      hours = 12;
      } // end if
      time_txt.text = _loc2 + "." + _loc3 + " " + ampm + ", " + date.getDate() + " " + dayOfWeek_array[_loc1.getDay()] + " " + months_array[date.getMonth()] + " " + date.getFullYear();
      };
      F_clock();
      setInterval(F_clock, 1000);

        • 1. Re: Can Military Time be reset to Regular time in Flash File?
          Ned Murphy Adobe Community Professional & MVP

          From what I can see, the code you show is displaying non-military time.  Is there a specific problem with it?

          .

          • 2. Re: Can Military Time be reset to Regular time in Flash File?
            iceministries Level 1

            The message you sent requires that you verify that you

            are a real live human being and not a spam source.

             

            To complete this verification, simply reply to this message and leave the subject line intact.

             

            We apologize for any inconvenience this may cause but we have been receiving a volume of UNWANTED SPAM therefore we had to initiate this procedure to stop them from coming.  Once you reply to this email you will no longer be required to do this anymore and you email will go through as normal.

             

            God bless you for your understanding and patience

             

            ICEMINISTRIES, INT&#39;L STAFF

             

            The headers of the message sent from your address are show below:

             

            From forums@adobe.com Fri Aug 27 13:46:46 2010

            Received: from mail.sgaur.hosted.jivesoftware.com (:47368)

                 by gator226.hostgator.com with esmtp (Exim 4.69)

                 (envelope-from <forums@adobe.com>)

                 id 1Op3ws-00029H-AY

                 for icem@iceministries.org; Fri, 27 Aug 2010 13:46:46 -0500

            Received: from sgaurwa44p (unknown )

                 by mail.sgaur.hosted.jivesoftware.com (Postfix) with ESMTP id EAF64E31E84

                 for <icem@iceministries.org>; Fri, 27 Aug 2010 12:46:48 -0600 (MDT)

            Date: Fri, 27 Aug 2010 12:46:45 -0600

            From: Ned Murphy <forums@adobe.com>

            Reply-To: clearspace-1069710804-40322-2-3089266@mail.forums.adobe.com

            To: Michael Anson <icem@iceministries.org>

            Message-ID: <1084768362.2172121282934808955.JavaMail.jive@sgaurwa44p>

            Subject: Can Military Time be reset to Regular time

            in Flash File?

            MIME-Version: 1.0

            Content-Type: multipart/mixed;

                 boundary="----=_Part_220461_426678043.1282934805785"

            Content-Disposition: inline

            • 3. Re: Can Military Time be reset to Regular time in Flash File?
              iceministries Level 1

              Hi,

               

              Sorry for the delay in responding, Hurricane Earl just went through our island so we had power outages.  Anyway, in answer to your question...the clock will not change from "PM" to "AM" and at 12 a.m. it goes to 0:00, instead of 12:00.  Is there any way that this can be fixed?

               

              Thanks

              • 4. Re: Can Military Time be reset to Regular time in Flash File?
                Ned Murphy Adobe Community Professional & MVP

                You appear to have an issue with the hours logic... what you have would make 12 noon appear as a 0. 

                 

                if (_loc1.getHours() < 12)                 // should be <= 12
                {
                _loc2 = _loc1.getHours();
                }
                else
                {
                _loc2 = _loc1.getHours() - 12;
                }

                 

                I also notice you are using an hours variable, but nowhere do you declare it nor assign it a value before you test it, which cannot be helping...

                 

                if (hours >= 12)       // hours is undefined at this point
                {
                hours = hours - 12;
                ampm = "PM";
                }
                else
                {
                ampm = "AM";
                }

                 

                You may be confusing yourself with the various variables you have at work, so it might help you to get those under control.  You should be able to decide AM vs PM based solely on the getHours() value.   getHours() values > 12 should be the only case where you subtract 12 to get the non-military PM hour values.  A getHours() value of zero is all you need to determine when to change it to be 12 (AM)

                1 person found this helpful
                • 5. Re: Can Military Time be reset to Regular time in Flash File?
                  iceministries Level 1

                  The message you sent requires that you verify that you

                  are a real live human being and not a spam source.

                   

                  To complete this verification, simply reply to this message and leave the subject line intact.

                   

                  We apologize for any inconvenience this may cause but we have been receiving a volume of UNWANTED SPAM therefore we had to initiate this procedure to stop them from coming.  Once you reply to this email you will no longer be required to do this anymore and you email will go through as normal.

                   

                  God bless you for your understanding and patience

                   

                  ICEMINISTRIES, INT&#39;L STAFF

                   

                  The headers of the message sent from your address are show below:

                   

                  From forums@adobe.com Wed Sep 01 11:27:53 2010

                  Received: from mail.sgaur.hosted.jivesoftware.com (:35616)

                       by gator226.hostgator.com with esmtp (Exim 4.69)

                       (envelope-from <forums@adobe.com>)

                       id 1OqqAD-0006bX-4a

                       for icem@iceministries.org; Wed, 01 Sep 2010 11:27:53 -0500

                  Received: from sgaurwa43p (unknown )

                       by mail.sgaur.hosted.jivesoftware.com (Postfix) with ESMTP id 039BC2409A27

                       for <icem@iceministries.org>; Wed,  1 Sep 2010 10:27:49 -0600 (MDT)

                  Date: Wed, 01 Sep 2010 10:27:38 -0600

                  From: Ned Murphy <forums@adobe.com>

                  Reply-To: clearspace-137041958-40322-2-3101006@mail.forums.adobe.com

                  To: Michael Anson <icem@iceministries.org>

                  Message-ID: <1498639528.786471283358469050.JavaMail.jive@sgaurwa43p>

                  Subject: Can Military Time be reset to Regular time

                  in Flash File?

                  MIME-Version: 1.0

                  Content-Type: multipart/mixed;

                       boundary="----=_Part_80105_2022858504.1283358458604"

                  Content-Disposition: inline

                  • 7. Re: Can Military Time be reset to Regular time in Flash File?
                    Ned Murphy Adobe Community Professional & MVP

                    Can you mark this posting as answered?  Below is the revised code, with all redundant or unused elements removed, misspellings corrected, and punctuation done properly...

                     

                    var months_array = ["JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"];
                    var dayOfWeek_array = new Array("SUN", "MON", "TUE", "WED", "THUR", "FRI", "SAT");

                     

                    function F_clock()
                    {
                    var date = new Date();
                    var mins = date.getMinutes();
                    var hrs = date.getHours();

                    if (mins < 10)
                    {
                      mins = "0" + mins;
                    }

                    if (hrs >= 12)
                    {
                      ampm = "PM";
                      if(hrs > 12)
                      {
                       hrs = hrs - 12;
                      }
                    }
                    else
                    {
                      ampm = "AM";
                    }

                    if(hrs == 0)
                    {
                      hrs = 12;
                    }

                    if (hrs < 10)
                    {
                      hrs = "0" + hrs;
                    }

                    time_txt.text = hrs + ":" + mins + " " + ampm + ", " + date.getDate() + " " + dayOfWeek_array[date.getDay()] + " " + months_array[date.getMonth()] + " " + date.getFullYear();
                    };

                    F_clock();
                    setInterval(F_clock, 1000);

                    • 8. Re: Can Military Time be reset to Regular time in Flash File?
                      iceministries Level 1

                      The message you sent requires that you verify that you

                      are a real live human being and not a spam source.

                       

                      To complete this verification, simply reply to this message and leave the subject line intact.

                       

                      We apologize for any inconvenience this may cause but we have been receiving a volume of UNWANTED SPAM therefore we had to initiate this procedure to stop them from coming.  Once you reply to this email you will no longer be required to do this anymore and you email will go through as normal.

                       

                      God bless you for your understanding and patience

                       

                      ICEMINISTRIES, INT&#39;L STAFF

                       

                      The headers of the message sent from your address are show below:

                       

                      From forums@adobe.com Wed Sep 01 18:46:08 2010

                      Received: from mail.sgaur.hosted.jivesoftware.com (:56367)

                           by gator226.hostgator.com with esmtp (Exim 4.69)

                           (envelope-from <forums@adobe.com>)

                           id 1Oqx0K-0006Tu-ST

                           for icem@iceministries.org; Wed, 01 Sep 2010 18:46:08 -0500

                      Received: from sgaurwa43p (unknown )

                           by mail.sgaur.hosted.jivesoftware.com (Postfix) with ESMTP id 59AB1E30E91

                           for <icem@iceministries.org>; Wed,  1 Sep 2010 17:46:15 -0600 (MDT)

                      Date: Wed, 01 Sep 2010 17:46:12 -0600

                      From: Ned Murphy <forums@adobe.com>

                      Reply-To: clearspace-137041958-40322-2-3102139@mail.forums.adobe.com

                      To: Michael Anson <icem@iceministries.org>

                      Message-ID: <1961060211.868781283384775374.JavaMail.jive@sgaurwa43p>

                      Subject: Can Military Time be reset to Regular time

                      in Flash File?

                      MIME-Version: 1.0

                      Content-Type: multipart/mixed;

                           boundary="----=_Part_88452_225469154.1283384772131"

                      Content-Disposition: inline