Poczytaj o nowosciach w Atreo, a takze o ciekawostkach z branzy.

Poczytaj o nowosciach w Atreo, a takze o ciekawostkach z branzy.

Jesteś klientem? Jeśli masz chwilę czasu poczytaj o nowościach w firmie. Dajemy się poznać każdemu. Nie zamykamy się na klientów, wręcz przeciwnie.

Jesteś z branży? Zobacz wpisy technologiczne. Może znajdziesz rozwiązanie swojego problemu. Usługi które świadczymy, to nasza pasja. Dzielimy się wiedzą za darmo.

Data i czas javascript wyświetlanie (jQuery)

05-04-2015 20:06:06
a

To nasza fukncja js:

 

$(function() {
    var d = new Date();
    d.setDate(d.getDate());
    $('#date').html(d.getDate() + '.' + (d.getMonth()+1) + '.' + d.getFullYear() + ' ');

    setInterval( function() {
        var d = new Date();
        var hours = d.getHours();
        var minutes = d.getMinutes();
        var seconds = d.getSeconds();
        $("#time").html(( hours < 10 ? "0" : "" ) + hours + ':' + ( minutes < 10 ? "0" : "" ) + minutes + ':' + ( seconds < 10 ? "0" : "" ) + seconds);
    }, 1000);    
}); 

a to jej wykorzystanie w html (Pamiętaj by dołączyć bibliotekę jQuery):

Działające demo: link

Komentarze
  • Abdullah Abdullah

    17-01-2013 14:07:17 | Odpowiedz

    Maybe I'm just not finding the soltiuon I'm looking for but the frustrating thing about this problem is that your method (which is common) only displays the month names in one language, in this case English. What if the user is speaks another language? We can return a string that contains the user's native language month name with toLocaleDateString() assuming they left their OS at default settings and set their locale settings in their native language. So obviously javascript is able to access and read locale settings but thus far, I have not been able to find a way to make sure I'm just accessing the month name from the locale. This leaves the developer to have to manually translate the month name for every language they want to support using yours or similar methods. I'm hoping there's a better way but I'm fearing the worst right now.

  • Theriot Theriot

    09-04-2013 22:10:03 | Odpowiedz

    Aw, this was an exceptionally nice post. Taking the time and actual effort to produce a very good article… but what can I say… I put things off a lot and don't seem to get anything done.

  • Harris Harris

    14-04-2013 11:32:42 | Odpowiedz

    Hmm is anyone else experiencing problems with the pictures on this blog loading? I'm trying to determine if its a problem on my end or if it's the blog. Any suggestions would be greatly appreciated.

  • Gonsalves Gonsalves

    11-05-2013 06:05:52 | Odpowiedz

    Nice blog here! Also your site loads up fast! What web host are you using? Can I get your affiliate link to your host? I wish my website loaded up as quickly as yours lol

  • Nickel Nickel

    13-05-2013 08:01:05 | Odpowiedz

    Thanks for sharing your info. I truly appreciate your efforts and I will be waiting for your next write ups thank you once again.

  • Polanco Polanco

    01-11-2013 05:54:42 | Odpowiedz

    Hi there! I'm at work surfing around your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the excellent work!

Napisz komentarz


Strict Standards: Declaration of Tomato_View_Helper_Url::url() should be compatible with Zend_View_Helper_Url::url(array $urlOptions = Array, $name = NULL, $reset = false, $encode = true) in /home/atreo/www/libraries/Tomato/View/Helper/Url.php on line 22