Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
How to display current time using ng-forms

Display current time using ng-forms

<input
  type="time"
  class="form-control"
  path="time"
  formControlName="time"
  [ngClass]="{'is-invalid': submitted && f.time.errors}"
/>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try This one too

You can use the Angular2 Date Pipe to display a JavaScript Date object. Check the docs (linked) for the correct formatting that you are looking for.

Solution 1 :

@Component({
  selector: 'date-pipe',
  template: `<div>
    <p>Today is {{today | date}}</p>
    <p>Or if you prefer, {{today | date:'fullDate'}}</p>
    <p>The time is {{today | date:'jmZ'}}</p>
    <p>Finally the date and time is {{today | date:'short'}}</p>
  </div>`
})
export class DatePipeComponent {
  today: number = Date.now();
}

Solution 2 :

{{date  | date:'yyyy-MM-dd'}}

Solution 3 :

import { DatePipe } from '@angular/common'
...
constructor(public datepipe: DatePipe){}
...
myFunction(){
 this.date=new Date();
 let latest_date =this.datepipe.transform(this.date, 'yyyy-MM-dd');
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!