码迷,mamicode.com
首页 > 其他好文 > 详细

3.5 本地时间转换 获取星期几

时间:2018-03-22 01:46:20      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:logs   本地   sda   down   nes   int   local   body   port   


package main

import (
    "fmt"
    "time"
)

func main() {
    t := time.Date(2017, 11, 29, 21, 0, 0, 0, time.Local)
    fmt.Printf("Extracting units from: %v\n", t)

    dOfMonth := t.Day()
    weekDay := t.Weekday()
    month := t.Month()

    fmt.Printf("The %dth day of %v is %v\n", dOfMonth, month, weekDay)

}

/*
Extracting units from: 2017-11-29 21:00:00 +0800 CST
The 29th day of November is Wednesday

*/

3.5 本地时间转换 获取星期几

标签:logs   本地   sda   down   nes   int   local   body   port   

原文地址:https://www.cnblogs.com/zrdpy/p/8620851.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!