Sponsored Content
Top Forums Web Development A simple UNIXtime component in Vue.js Post 303025614 by Neo on Wednesday 7th of November 2018 06:54:22 AM
Old 11-07-2018
A simple UNIXtime component in Vue.js

A shout out to Scott who gave me a helping hand to turn a simple sample Vue.js app I wrote yesterday into a Vue.js component:

Code:
Vue.component("unix-time", {
  template: `<div class="time">{{unixtime}}</div>`,
  data() {
    return {
      unixtime: ""
    };
  },
  methods: {
    UpdateTime() {
      this.unixtime = Math.round(new Date().getTime() / 1000);
    }
  },
  created() {
    setInterval(() => {
      this.UpdateTime();
    }, 1000);
  }
});

For any Vue'ers who want the complete code, you can add this component to any root Vue.js element as long as the Vue instance is instantiated after the component appears in the script, for example, any root level element (like the one below) that appears after the component.

Code:
new Vue({
    el: '#myunixtime',
})

Then, in the HTML, just do something like this:

Code:
<div id="myunixtime">
      <unix-time></unix-time>
</div>

Thanks again to Scott for learning Vue.js with me and for the helping hand!

Maybe we will add this simple unixtime clock to the forums somewhere or use this component to replace the unixtime on the home page.....
This User Gave Thanks to Neo For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problems with unixtime!

Hi, i have wrote a scripts thats connect too some tables in a phpBB community. I have got contact with all of the tables but becouse phpBB uses unixtime, it is showed wrong. 0312011557 (Wednesday, 12. january, 15.57). I ask on this page becouse it is a unixpage, sow I wonder i someone has a script... (1 Reply)
Discussion started by: ett
1 Replies

2. UNIX for Advanced & Expert Users

converting localtime to unixtime

hi, how to convert the localtime to unixtime? i have date from the date command in unix i want to convert it into unixtime thnx (2 Replies)
Discussion started by: AshishK
2 Replies

3. Shell Programming and Scripting

Replace date_time to unixtime in csv.file

Hello, since hours I am trying to replace in a csv-file the date_time to unixtime. I tried sed, awk but not successful. I can not call a shell command within awk. Probably there is an easier way. Thanks in advance for your help Regards, telemi test.csv: 2010-04-22... (5 Replies)
Discussion started by: telemi
5 Replies

4. Shell Programming and Scripting

unixtime to formatted date time

Hi, I need to take the unix time and format it to a date/time string like this yyyymmdd,hhmmss I'm wrting in shell but have tried calling perl, but all the perl options I found on here puts output to Thu Jan 1 00:00:00 1970 format. Any help? Cheers Neil (4 Replies)
Discussion started by: nhatch
4 Replies

5. Shell Programming and Scripting

Multiple records need to convert UNIXtime to human readable datatime and all output in one format

Hello Experts, Below is the record i have: sample data attached I want this record of each row to be in single line and there are multiple rowise unixtime mentioned e.g 11996327 , This needs to be converted to Human readdable data and time from multiple rows Can you help me , it will be... (10 Replies)
Discussion started by: manishK
10 Replies

6. Web Development

A Simple Way to Set Meta Tags Using Vue.js

Did a lot of searching on the net and found a lot of tricky ways and Vue.js libs to set meta tags, but I wanted sometime simpler. So, given this standard HTML: <head> <title>Page Title</title> <meta name="description" content="Page Description"> <meta name="keywords" content="Page... (0 Replies)
Discussion started by: Neo
0 Replies

7. Web Development

Simple Vue.js Component to Redirect to External Web Page Using Vue Router

Vue Router has some quirks and on of the quirks is that it is not reliable when adding external links using the vue-router library. After struggling with many solutions, I have found that creating a simple Vue.js component like this one seems to work the best (so far): Component Example: ... (0 Replies)
Discussion started by: Neo
0 Replies

8. Web Development

Vue JS 2 Tutorial by The Net Ninja: A Recommended Vue.js Video Tutorial Series

A number of people have asked me how to get started with Vue.js and my reply before today was to Google "Vue.js". That has changed and my recommendation to anyone who wants to learn the fastest growing, easiest to learn and use Vue.js web dev framework is to watch this video tutorial series: ... (0 Replies)
Discussion started by: Neo
0 Replies

9. Web Development

The State of Vue.js

Here is very good video from Evan You, founder of Vue.js, on the state of Vue.js State of Vuenation with Evan You Here is a nice PDF report on Vue.js Update State of Vue.js Report Vue.js is now the second most starred project on GitHub, recently surpassing Bootstrap. These two... (0 Replies)
Discussion started by: Neo
0 Replies

10. Web Development

Vue.js component: Beautiful code highlighter

Sooner than later I will render forum discussions in Vue.js to complement the standard way of showing forum threads. Today, I ran across this component, vue-code-highlight Beautiful code syntax highlighting as Vue.js component. https://www.unix.com/members/1-albums225-picture1199.jpg ... (1 Reply)
Discussion started by: Neo
1 Replies
MHPARAM(1)							     [nmh-1.5]								MHPARAM(1)

NAME
mhparam - print nmh profile and context components SYNOPSIS
mhparam [components] [-all] [-component | -nocomponent] [-version] [-help] DESCRIPTION
mhparam writes the value of the specified profile component to the standard output separated by newlines. If the profile component is not present, the default value (or nothing if there is no default) is printed. If the switch -component is given, then the component name is displayed along with the profile components value. This can be disabled with the switch -nocomponent. If more than one component is specified in the components list, then the switch -component is on by default. If only one component is specified, then the switch -nocomponent is on by default. If -all is specified, then all components in the nmh profile are displayed and other arguments are ignored. Examples: % mhparam path Mail % mhparam mhlproc /usr/lib/mh/mhl % mhparam -component Path Path: Mail % mhparam AliasFile rmmproc AliasFile: aliases rmmproc: rmmproc % mhparam -nocomponent AliasFile rmmproc aliases rmmproc % mhparam path nonexistent context Path: Mail context: context mhparam is also useful in back-quoted operations: % fgrep cornell.edu `mhpath +`/`mhparam aliasfile` EXIT STATUS
mhparam returns the number of components that were not found. FILES
$HOME/.mh_profile The user profile or $MH Rather than the standard profile <mh-dir>/context The user context or $MHCONTEXT Rather than the standard context PROFILE COMPONENTS
context: To determine the context file SEE ALSO
mh-profile(5) DEFAULTS
`-nocomponent' if only one component is specified `-component' if more than one component is specified `components' defaults to none CONTEXT
None MH.6.8 11 June 2012 MHPARAM(1)
All times are GMT -4. The time now is 06:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy