How do I display todays date in Node.js Jade?

前端 未结 7 1359
囚心锁ツ
囚心锁ツ 2021-01-31 15:04

I am new to Node.js and Jade and I have tried to use #{Date.now()} and it\'s giving me numbers. How do I display the date in mm/dd/yy format?

相关标签:
7条回答
  • 2021-01-31 16:06

    add the class .post-date to a tag holding the date

    document.addEventListener('DOMContentLoaded', function() {
        var list = document.getElementsByClassName('post-date');
                    // get the number of selected elements
    
                    // iterate over elements and output their HTML content
                    for (var i=0; i<list.length; i++){
                        //console.log(list[i].innerHTML);
                        var string=list[i].innerHTML;
                        var length = 15;
                        var trimmedString = string.substring(0, length);
                        list[i].innerHTML=trimmedString ;
                    }
    
    })
    
    0 讨论(0)
提交回复
热议问题