+ Start a Discussion
venkat bojjavenkat bojja 

How to Display the current system date with Time in lightning

Hi Team,

How to Display the current system date and Time with better UI template in lightning.Please help me on this.
                                 Thanks in advance....
SandhyaSandhya (Salesforce Developers) 

Refer below sample code.
   <aura:handler name="init" action="{!c.init}" value="{!this}" />
   <aura:attribute name="today" type="Date" />
init : function(component, event, helper) {
    var today = new Date();
    var monthDigit = today.getMonth() + 1;
    if (monthDigit <= 9) {
        monthDigit = '0' + monthDigit;
    component.set('v.today', today.getFullYear() + "-" + monthDigit + "-" + today.getDate());


Please mark it as solved if my reply was helpful, it will make it available
for others as a proper solution.

Best Regards,
venkat bojjavenkat bojja
Hi  Sandhya,

Thanks for your quick responce. I tried with your code but i am not getting any output. Could you please check it once.And i need to get the output like below format in image.Please help me on this.
                                                                  Thanks in advance...

User-added image\