zoukankan      html  css  js  c++  java
  • VB6之从1970年1月1日起的秒数 的与C语言类似的时间函数

    程序里 时间一般都用 1970-1-1 到现在的时间了  

    Function getSecondsFrom1970() As Long
        '%s  seconds since `00:00:00 1970-01-01 UTC" (a GNU extension)
        getSecondsFrom1970 = DateDiff("s", "1970/01/01", Now())
        '2011/03/02 18:11:24 =>1299089484
        
    End Function
    Function getDateTimeFromSeconds(ByVal seconds As Long) As String
        getDateTimeFromSeconds = Format(DateAdd("s", seconds, "1970/01/01"), "YYYY/MM/DD HH:mm:ss")
        '1299089484=>2011/03/02 下午 06:11:24
        
    End Function

    VB6 1970-01-01秒數時間格式轉換 

    以前 我老笨了,居然 根据now获得 年月日 小时 分钟 秒,然后再弄个 闰年判断函数,从1970年 计算到现在。。真是弱智到顶了。。。

  • 相关阅读:
    2016九大前端必备动画库
    关于页面跳转,登录刷新
    关于换行
    c++ vector 的使用
    c++ namespace的使用
    u盘文件系统故障的修复方法
    nfs的使用
    ubuntu 无声音的解决
    Yii 视图中的 $this
    Apache vhost
  • 原文地址:https://www.cnblogs.com/ayanmw/p/2556630.html
Copyright © 2011-2022 走看看