fix work with datetime
This commit is contained in:
parent
ae99192765
commit
d36d46d409
@ -1 +1 @@
|
|||||||
"2022-06-03 08:02:08.563110"
|
"2022-06-06 18:23:00.7168350"
|
||||||
|
8
main.py
8
main.py
@ -20,8 +20,8 @@ def main():
|
|||||||
date = json.load(json_file)
|
date = json.load(json_file)
|
||||||
|
|
||||||
cursor = cnxn.cursor()
|
cursor = cnxn.cursor()
|
||||||
cursor.execute("SELECT Id, Title, Body FROM Newses "
|
cursor.execute("SELECT Id, Title, Body, DateCreate FROM Newses "
|
||||||
"WHERE Newses.IsDeleted = 0 AND Newses.DateCreate >= ? "
|
"WHERE Newses.IsDeleted = 0 AND Newses.DateCreate > ? "
|
||||||
"ORDER BY Newses.DateCreate", date) # например - 2022-04-02 11:19:29.778400
|
"ORDER BY Newses.DateCreate", date) # например - 2022-04-02 11:19:29.778400
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
|
|
||||||
@ -32,10 +32,12 @@ def main():
|
|||||||
'text': f'{row[1]}\n{textNews}\nhttp://is.ulstu.ru/News/ShowNews/{row[0]}'}
|
'text': f'{row[1]}\n{textNews}\nhttp://is.ulstu.ru/News/ShowNews/{row[0]}'}
|
||||||
requests.get('https://api.telegram.org/bot5567223643:AAG6DYNUNq7BNqm7-pI2p-SdvEmAKielViE/sendMessage',
|
requests.get('https://api.telegram.org/bot5567223643:AAG6DYNUNq7BNqm7-pI2p-SdvEmAKielViE/sendMessage',
|
||||||
params=params)
|
params=params)
|
||||||
|
date = row[3]
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
|
|
||||||
|
|
||||||
with open('datetime.json', 'w') as outfile:
|
with open('datetime.json', 'w') as outfile:
|
||||||
json.dump(str(datetime.now()), outfile)
|
json.dump(str(date), outfile)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user