01.
Public
Function
Sys_now(
Optional
ByVal
StrFormat$ =
"dd/MM/yyyy"
)
As
String
02.
Sys_now =
""
03.
Dim
RS
As
New
ADODB.Recordset
04.
Dim
strMonth$, StrYear$, strHour$, strMinute$, strSecond$, NowYear$
05.
06.
SQL = (
"select DATENAME(day, getdate()) , DATENAME(month, getdate()), DATENAME(year, getdate()) , DATENAME(hour, getdate()) , DATENAME(minute, getdate()) , DATENAME(second, getdate()) "
)
07.
RS.Open(SQL, Conn, 3, 1)
08.
strDay = RS.Fields(0).Value
09.
strMonth = RS.Fields(1).Value
10.
StrYear = RS.Fields(2).Value
11.
strHour = RS.Fields(3).Value
12.
strMinute = RS.Fields(4).Value
13.
strSecond = RS.Fields(5).Value
14.
RS =
Nothing
15.
16.
NowYear = Now.Year
17.
Dim
DateT
As
Date
18.
DateT = strDay +
" "
+ strMonth +
" "
+ NowYear +
" "
+ strHour +
":"
+ strMinute +
":"
+ strSecond
19.
Sys_now = Replace(Format(DateT, StrFormat), NowYear, StrYear)
20.
End
Function