• Summary of common operations of Python time module


    The common operations of the time module are summarized as the following functions: #!/usr/bin/env python # -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding(‘utf-8’) import time import datetime import calendar def second_to_datetime_string(seconds): “”” Converts the number of seconds from A.D. 0 to the string form of datetime : param seconds: the number of seconds from […]

  • Learn a Linux command every day (96): ntpdate


    Command introduction The ntpddate command is used to set the date and time using the network timing protocol (NTP). It can also be used to synchronize time. This command can be executed only with root administrator privileges. [[email protected] ~]# ntpdate -bash: ntpdate: command not found [[email protected] ~]# yum install ntpdate -y Syntax format ntpdate [ -b] [ -d] [ -s] [ -u] [ -aKeyid] [ -eAuthenticationDelay] [ -kKeyFile] [ -oVersion] [ -pSamples] [ -tTimeOut] Server… Option description -aKeyid   # use   Keyid   To authenticate all packets […]

  • Online high precision Online timer (stopwatch)


    Online high precision Online timer (stopwatch) Stopwatch timer, which can record the number of seconds at multiple time points. Simple operation and easy to use. The stopwatch starts timing after the start point. It can be divided many times when the stopwatch is running, and can be reset with one key after stopping. Online high […]

  • JS implementation countdown


    Many games are used to countdown, such as annual meeting, birthday, date… Nonsense, not much code design sketch: index.html <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <title>Document</title> <style> body{ background-color: #2a3852; } #box { display: flex; justify-content: center; align-items: center; flex-direction: column; margin-top: 300px; } #box h1 { letter-spacing: 3px; font-weight: […]

  • Python time difference calculation


    Method 1: the time to be calculated is a fixed value import datetime c=”2020-12-08 11:30:00″ d1=datetime.datetime.strptime(str(c),”%Y-%m-%d %H:%M:%S”) d3 = d1 – datetime.timedelta(seconds=900) d3.ctime() Method 2: use the current time for calculation Datetime can view: days, hours, weekday (); Timedelta can view: days, seconds, etc. import datetime d1 = datetime.datetime.now() d3 = d1 + datetime.timedelta(hours=10) d3.ctime()

  • This Linux command can turn back the clock! You don’t know the hidden usage of date


    Today, I wrote a script for the project. I need to get the time of the previous day. Originally, I got the time of today and then subtracted it. If it’s the 1st, I have to consider the big and small months. It’s very complicated, so I checked the manualdateCommand native support, overjoyed, today we […]

  • Common function set


    Utility function set <? php Common functions php function helper This work adoptsCC agreementReprint must indicate the author and the link of this article

  • Learn a Linux command every day (91): NC


    Command introduction NC command is a powerful network tool. It is a port scanning tool, a security tool, a monitoring tool, and even a simple TCP proxy. Grammatical format nc  [- Hlnruz] [- G < gateway… >] [- G < number of directors >] [- I < delay seconds >] [- O < output file […]

  • Go carbon Version 1.2.1 has been released, adding several new methods


    Carbon is a lightweight, semantic and developer friendly golang time processing library, which supports chain call, lunar calendar, Gorm, xorm and other mainstream orm If you think it’s good, please give it to a star github:github.com/golang-module/carbon gitee:gitee.com/go-package/carbon Installation and use //Using GitHub Library go get -u github.com/golang-module/carbon import ( “github.com/golang-module/carbon”) //Using gitee Library go get […]

  • JavaScript displays the remaining time function


    Realization idea: The input time minus the current time is the remaining time, but you can’t subtract the time, minutes and seconds. For example, if you subtract 25 minutes from 05 minutes, the result will be negative. You can use ittime stampTo do this, subtract the total number of milliseconds of the current time from […]

  • Django set database cache


    Recently, many new functions have been added to the blog, and the speed of access has declined. When searching on a domestic search engine, I saw this text. It’s simple and clear, so I forward it. Although it’s not original, I hope it can help more friends. Django official cache system introduction: https://docs.djangoproject.com/en/1.8/to… Configure cache […]

  • JavaScript realizes countdown effect


    Realization idea: For the remaining time, please refer to the function display for detailscountDown(time) Using timerssetInterval(countDown, 1000)Refresh every second, that is, to achieve the dynamic countdown once every second Code implementation: HTML: 1 2 3 4 CSS: div { margin: 200px; } span { display: inline-block; width: 40px; height: 40px; background-color: #333; font-size: 20px; color: […]