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

390
Views
How to get current date and time of user laptop not server in angular?

I have deployed the angular app on the server, but I want to get my system (laptop) date and time in the application.
Suppose the server has the date and time of timeZoneA while my laptop has date and time of TimeZoneB, so basically, I want that timeZoneB should be shown in the application opened in the browser of my laptop.

this.currentDateTime = new Date();

I can get date and time of any specific zone. but it's not requirement.

formatDate(new Date(),'dd-MM-yyyy hh:mm:ss a','en-US','+0500');
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In the question you are passing the timezone in formatDate so that is why you are getting the specific timezone date.

Remove the timezone from formatDate to the local date and time.

change :

formatDate(new Date(), 'dd-MM-yyyy hh:mm:ss a','en-US','+0500');

to :

date = formatDate(new Date(), 'dd-MM-yyyy hh:mm:ss a', 'en-US');

If you want to get the time of specific time zone :

function getTime(){
    //timeZone can be  "CST","GMT" ,"Asia/Jerusalem" , etc
    var d = new Date(new Date().toLocaleString("en-US", {timeZone: "CST"}));
    var n = d.toLocaleString(); // just to get date & time
    return n;
}
over 4 years ago · Santiago Trujillo 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!