本文整理汇总了Python中DateTime.gmtime方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.gmtime方法的具体用法?Python DateTime.gmtime怎么用?Python DateTime.gmtime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime.gmtime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_entry
# 需要导入模块: import DateTime [as 别名]
# 或者: from DateTime import gmtime [as 别名]
def get_entry(caseNum, ticks):
thisDate = DateTime.gmtime(ticks)
findDate = DateTime.ISO.strGMT(thisDate)
entries = mydb.query("SELECT comments, analysis from annotations where ( validtime = '"+findDate+"' and casenum = '"+caseNum+"' )")
entries = entries.getresult()
return entries
示例2: add_entry
# 需要导入模块: import DateTime [as 别名]
# 或者: from DateTime import gmtime [as 别名]
def add_entry(ticks, comments, analysis, caseNum):
comments = regsub.gsub("'","´", comments)
analysis = regsub.gsub("'","´", analysis)
thisDate = DateTime.gmtime(ticks)
findDate = DateTime.ISO.strGMT(thisDate)
delete = mydb.query("delete from annotations WHERE validtime = '"+findDate+"' and casenum = '"+caseNum+"' ")
insert = mydb.query("insert into annotations (validtime, comments, analysis, casenum) values('"+findDate+"','"+comments+"','"+analysis+"','"+caseNum+"')")
print 'DONE'
示例3: Main
# 需要导入模块: import DateTime [as 别名]
# 或者: from DateTime import gmtime [as 别名]
def Main():
form = cgi.FormContent()
zticks = str(form["zticks"][0])
caseNum = str(form["caseNum"][0])
nowDate = DateTime.gmtime(zticks)
strTicks = DateTime.ISO.strGMT(nowDate)
delete = mydb.query("DELETE from specquestions WHERE validTime = '"+strTicks+"' ")
style.jump_page('index.py?caseNum='+caseNum)
示例4: Main
# 需要导入模块: import DateTime [as 别名]
# 或者: from DateTime import gmtime [as 别名]
def Main():
style.header("Edit Questions", "white")
form = cgi.FormContent()
zticks = form["zticks"][0]
caseNum = form["caseNum"][0]
zticks = int( float(zticks) )
nowDate = DateTime.gmtime(zticks)
nice_date = nowDate.strftime("%x %H Z")
strTicks = DateTime.ISO.strGMT(nowDate)
add_entry( strTicks )
print '<H2 align="CENTER">Edit Question for '+nice_date+':</H2>'
print '<HR>'
print '<a href="del.py?caseNum='+caseNum+'&zticks='+str(zticks)+'">Delete this question from DB</a>'
entry = mydb.query("SELECT * from "+table_str+" WHERE validTime = '"+strTicks+"' ").dictresult()
question = entry[0]["question"]
type = entry[0]["type"]
optiona = entry[0]["optiona"]
optionb = entry[0]["optionb"]
optionc = entry[0]["optionc"]
optiond = entry[0]["optiond"]
optione = entry[0]["optione"]
optionf = entry[0]["optionf"]
answer = entry[0]["answer"]
cor_comments = entry[0]["correct"]
wro_comments = entry[0]["wrong"]
print '<form method="POST" action="change.py">'
print '<input type="hidden" name="validTime" value="'+strTicks+'">'
print '<input type="hidden" name="caseNum" value="'+caseNum+'">'
mk_question(question)
mk_type(type)
mk_optiona(optiona)
mk_optionb(optionb)
mk_optionc(optionc)
mk_optiond(optiond)
mk_optione(optione)
mk_optionf(optionf)
mk_answer(answer)
mk_cor_comments(cor_comments)
mk_wro_comments(wro_comments)
print '<input type="SUBMIT" value="Make Changes">'
print '</form></body></html>'
示例5: get_entry
# 需要导入模块: import DateTime [as 别名]
# 或者: from DateTime import gmtime [as 别名]
def get_entry(caseNum, ticks):
thisDate = DateTime.gmtime(ticks)
findDate = DateTime.ISO.strGMT(thisDate)
entries1 = mydb.query("SELECT comments, analysis from annotations where ( validtime = '"+findDate+"' and casenum = '"+caseNum+"' )")
entries2 = mydb1.query("SELECT comments, analysis from annotations where ( validtime = '"+findDate+"' and casenum = '"+caseNum+"' )")
entries3 = mydb1.query("SELECT comments, analysis from annotations_custom where ( validtime = '"+findDate+"' and casenum = '"+caseNum+"' and className = '"+className+"')")
entries1 = entries1.dictresult()
entries2 = entries2.dictresult()
entries3 = entries3.dictresult()
if len(entries3) > 0:
return entries3
if len(entries2) > 0:
return entries2
return entries3
示例6: __init__
# 需要导入模块: import DateTime [as 别名]
# 或者: from DateTime import gmtime [as 别名]
def __init__(self, description, results):
"""construct with the description fetched from a database cursor and
with the result rows from a query"""
data = []
for result in results:
row = {}
for item, desc in map(None, result, description):
if desc[1] == 'DATE':
if item is not None:
item = DateTime.gmtime(float(item))
elif desc[1] == 'RAW':
item = str(item)
row[string.lower(desc[0])] = item
data.append(row)
self.data = tuple(data)