如果今天应用,我想返回19年1月1日至20年2月25日的值。
我目前正在使用以下内容,但希望将其替换为可以给我4个完整月份和当前部分月份的内容
where DATEDIFF (day,[SubOrderCompletionDate],GETDATE()) between 0 and 180
谢谢
答案 0 :(得分:1)
如果您需要完整的月份,只需将其更改为:
where DATEDIFF(month, SubOrderCompletionDate, GETDATE()) between 0 and 3
DATEDIFF()
计算两个日期之间的边界数。因此,给定日历月内的所有天都返回相同的值。
答案 1 :(得分:0)
我已按字面意思接受了您的声明,因此假设如果今天是2020年2月29日,则您希望的是2019年11月1日至2020年2月29日,而不是2019年10月1日至2020年2月29日:
ValueError: unsupported format character '{' (0x7b) at index 40
如果不是这种情况,则只需要import subprocess
def webSpeed():
website = raw_input("Enter name of the website: ")
print(website)
cmd = "curl -s -w 'Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nAppCon Time:\t\t%{time_appconnect}\nRedirect Time:\t\t%{time_redirect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://%s" %(webiste)
print(cmd)
temp = subprocess.call(cmd, shell="TRUE")
print(temp)
,这将为您提供 5 个月的数据。