zoukankan      html  css  js  c++  java
  • 1.微信小程序里如何设置当地时间?

    方法一:

    1.效果图

    2.wxml code:

    <!--pages/index/index.wxml-->
    <text>当前时间:{{time}}</text>
    <text>当前大时间:{{ymdtime}}</text>
    <text>当前小时间:{{hmstime}}</text>

    3.js code:

    // pages/index/index.js
    Page({
      /**
       * 页面的初始数据
       */
      data: {
        time: (new Date()).toString()
        ymdtime: (new Date()).toString().slice(0,15),
        hmstime: (new Date()).toString().slice(16, 24),      
      },
    })

    在此,slice()方法就是用来截取一段字符串。

  • 相关阅读:
    Python Day14
    Python Day13
    Python Day12
    Python Day11
    Python Day10
    Python Day9
    Python Day8
    Python Day7
    Python Day6
    Python Day5
  • 原文地址:https://www.cnblogs.com/FlyingLiao/p/10663191.html
Copyright © 2011-2022 走看看