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

160
Views
vue timestamp in particular time zone

I am using a timestamp attribute to display the current time and date on my page.

Is it possible to display it in a particular time zone? I want to display it in ZULU timezone which is static and does not observe daylight saving time.

<script>
import Logger from './Logger'

export default {
  name: 'Navbar',
  components: {
    Logger
  },
  data: {
    timestamp: ""
  },
  created() {
    setInterval(this.getNow, 1000);
  },
  methods: {
    getNow: function() {
      const today = new Date();
      const date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
      const time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds() + " - " +  "ZULU";
      const dateTime = date +' '+ time;
      this.timestamp = dateTime;
    }
  }
}
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I believe this is not a Vue question, but a regular JavaScript question because Date() is built into JavaScript. When you first create the Date, it uses the time zone of the host system that created it. Then after the date is created, you can convert it to the ZULU time zone using the builtin toLocaleString function, as shown in this answer: Convert date to another timezone in JavaScript

Here is more information about toLocaleString and how it can be used to convert time zones: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString

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!