如何使用mysql查询获取系统的当前时间。
我尝试NOW()函数并返回
2017-11-07 05:36:16
但我的系统时间是
2017-11-07 11:06:16.
如何获得准确的系统时间?
如何在mysql查询中实现?
答案 0 :(得分:0)
根据MySQL文档,有一个number of ways来执行此操作。
按照文档,打开my.cnf
文件(MySQL配置)。在Linux上,通常位于/etc/my.cnf
或/etc/mysql/my.cnf
下。在Windows上,请参阅other places to look。
添加此行并重启MySQL。
default-time-zone='[TIMEZONE]'
将[TIMEZONE]
替换为您喜欢使用的时区。
该值可以作为表示与UTC的偏移量的字符串给出,例如 为'+10:00'或'-6:00'。
答案 1 :(得分:-1)
使用Sub TruckFilterType()
Dim counter As Integer
Dim state As Integer
counter = 2
state = 1
For counter = 2 To 100
If Worksheets("Sheet1").Cells(counter, 1).Value = "#N/A" Then
If state = 1 Then
Worksheets("Sheet1").Cells(counter, 1).Value = "TYPE 1"
state = 2
ElseIf state = 2 Then
Worksheets("Sheet1").Cells(counter, 1).Value = "TYPE 2"
state = 1
End If
End If
Next counter
End Sub
根据您的系统时间获取日期和时间。
就像你在印度一样,date_default_timezone_set('YOUR_TIMEZONE')
您可以在此处找到所有Supported timezones。
快乐编码: - )