Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:18:38+00:00 2026-06-18T00:18:38+00:00

i’ve been trying to do a live watch with javascript to be shown in

  • 0

i’ve been trying to do a live watch with javascript to be shown in a twig template, the issue is, it doesn’t update automatically when the time changes, i don’t know if it’s my mistake or i’m not using javascript properly and it’s possible it’s a really dumb mistake or that i’m doing a rookie thing, so my apologies in advance.

<html>
    <head>
        <meta charset="UTF-8" />
        <title>{% block title %}Sistema de Soporte a Usuarios TiCad{% endblock %}</title>
        {% block stylesheets %}
    <link rel="stylesheet" href="{{ asset ('css/style.css')}}">
        {% endblock %}

        <link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>  
        <script src="{{asset ('js/jquery.min.js') }}"></script>
    <script src="{{asset ('js/script.js')}}"></script>   
        <script src="{{asset ('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js')}}"></script>  
    </head>
    <body>
 {% if app.session.hasFlash('notice') %} 
    <div id="flashmessage" class="flash-notice"> 
       {{ app.session.flash('notice') }} 
   </div> 
{% endif %}
 {% if app.session.hasFlash('info') %} 
    <div id="flashmessage" class="flash-notice"> 
       {{ app.session.flash('info') }} 
   </div> 
{% endif %} 
            <div id="top-bar">
                {% block bar %}
                    <div class="page-full-width cf">
            <ul id="nav" class="fl">
                <li class="v-sep"><a class="round button dark menu-user image-left">Ha iniciado sesion como <strong>{{app.user.username}}</strong></a>
                    <ul>
                        <li><a href="{{ path ('MonseUserBundle_User_show', { 'id': app.user.id })}}">Mi Perfil</a></li>
                        <li><a href="{{ path('logout')}}">Salir</a></li>
                    </ul> 
                </li>
                                <li><a class="round button dark clock image-left">
                                     <script type="text/javascript">
var d=new Date();
var dia=new Array(7);
dia[0]="Domingo";
dia[1]="Lunes";
dia[2]="Martes";
dia[3]="Miercoles";
dia[4]="Jueves";
dia[5]="Viernes";
dia[6]="Sabado";
var mm=new Date();
var m2 = mm.getMonth() + 1;
var mesok = (m2 < 10) ? '0' + m2 : m2;
var mesok=new Array(12);
mesok[0]="Enero";
mesok[1]="Febrero";
mesok[2]="Marzo";
mesok[3]="Abril";
mesok[4]="Mayo";
mesok[5]="Junio";
mesok[6]="Julio";
mesok[7]="Agosto";
mesok[8]="Septiembre";
mesok[9]="Octubre";
mesok[10]="Noviembre";
mesok[11]="Diciembre";
var Hours;
var Mins;
var Time;
Hours = d.getHours();
if (Hours >= 12) {
Time = " P.M.";
}
else {
Time = " A.M.";
}
if (Hours > 12) {
Hours -= 12;
}
if (Hours == 0) {
Hours = 12;
}
Mins = d.getMinutes();
if (Mins < 10) {
Mins = "0" + Mins;
}
document.write("" + dia[d.getDay()]+ ", " + d.getDate() + " de " + mesok[mm.getMonth()] +" de "+ d.getFullYear()+ " - "+ Hours + ":" + Mins +" "+Time);
</script>
                                    </a>
                               </li>
            </ul> <!-- end nav -->
                       <li><a href="logout" class="round button dark menu-logoff image-left fr">Salir</a></li>


        </div> <!-- end full-width -->  
                {% endblock bar %}
        </div> <!-- end top-bar -->


        {% block body %}
        {% endblock %}

        {% block javascripts %}
        {% endblock %}
        {% block footer %}
            <div id="footer">
        <p>&copy; Copyright 2013 <a href="http://www.twitter.com/monsefoster">Monse Foster</a>. Todos los derechos reservados.</p>

    </div> <!-- end footer -->
        {% endblock %}
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:18:39+00:00Added an answer on June 18, 2026 at 12:18 am

    The script doesn’t work because the time is dumped only once whereas it should be dumped every second. To do it use javascript function setInterval:

    var delay = 1000; // 1000 microseconds equal to 1 second
    
    // setInterval executes passed function every second
    setInterval(function() {
        // do time calculation and displaying
    }, delay);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to render a haml file in a javascript response like so:
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.