为什么这个功能不起作用?

时间:2015-04-30 15:07:08

标签: mysql function date asp-classic

知道为什么这不起作用?

function func_data(datdb)
    dat=(Year(datdb) &"-"& Month(datdb) &"-"& Day(datdb))
    hor=(hour(datdb) &":"& Minute(datdb) &":"& second(datdb))
    varr = dat&" "&hor
end function

data_pt = date
data_mysql = func_data(CDate((now)))
dia_semana = WeekDayName(WeekDay(Now())) 
mes = MonthName(Month(Now()))
hora = time
dataehora = now

response.write "<br>data_pt:"&data_pt
response.write "<br>data_mysql:"&data_mysql
response.write "<br>dia_semana:"&dia_semana
response.write "<br>mes:"&mes
response.write "<br>hora:"&hora
response.write "<br>dataehora:"&dataehora

它返回:

data_pt:30/04/2015

data_mysql:

dia_semana:quinta-feira

mes:abril

hora:16:03:30

dataehora:30/04/2015 16:03:30

正如您所看到的那样,将日期格式插入到mysql中的函数时间不起作用

1 个答案:

答案 0 :(得分:0)

我不熟悉ASP,但Classic ASP - Returning a value from a function建议您需要更改

varr = dat&" "&hor

func_data = dat&" "&hor

不仅可以计算func_data中的返回值,还可以将其返回给调用者。