javascript – how to get the current date with angularJS


How to get the return of the current date via javascript, in the time-label class you can use jquery or angular.

The idea is to have the latest update date.

If anyone knows I'm grateful.

You cannot insert the value directly, you have to create a function that at run time adds the date..

in an html class:

<div class="footer">
    <div class="col-md-12">
        <span class="pull-left time-label"></span>
        <div class="pull-right">
            <a href="#" class="toggle-legend visible-lg pull-left cLineSwap">Legend</a>


You can use it like this:

function dataHoje() {
    var data = new Date();
    var dia = data.getDate();
    var mes = data.getMonth() + 1;
    var ano = data.getFullYear();
    return [dia, mes, ano].join('/');
$('.time-label').html('Ultima atualização: ' + dataHoje());

In javascript the date has to be "broken" into day, month and year in order to be formatted that way.

Scroll to Top