0
I need to display on the page the current date followed by the current time, It follows what I have done so far, I only need to display the time if it continues as it is, follow code:
function dataHoje() {
var data = new Date();
var dia = data.getDate();
var mes = data.getMonth() + 1;
var ano = data.getFullYear();
return [dia, mes, ano].join('/');
}
Html:
<span class="pull-left time-label">
Currently playing: 15/4/2016 -
I just need the time, like this: 4/15/2016 - 2:55 pm
Anyone can help?
If you’re going to use pure javascript, this is the shape. Now as you’re using Angular, you can use the tools it offers you. And one question, why are you using jQuery to update the view data?
– adelmo00
I gave the example of pure javascript, but I just discovered the Moment.js that made it easy and easy.. Following link: http://momentjs.com/
– Maurício Krüger
Look at my answer. Angular gives native support to date format
– adelmo00