fix datetime
This commit is contained in:
parent
d36d46d409
commit
c79051b544
@ -1 +1 @@
|
||||
"2022-06-06 18:23:00.7168350"
|
||||
"2022-06-24 22:11:28.713372"
|
||||
|
15
main.py
15
main.py
@ -1,23 +1,30 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import pyodbc
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
messageTo = {'sam': '331491581', 'is': '-1001637207513'}
|
||||
driverFrom = {'lxc': '/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1}', 'windows': '{ODBC Driver 17 for SQL Server}'}
|
||||
|
||||
|
||||
server = '10.3.1.13\SQLEXPRESS'
|
||||
database = 'DepartmentDatabaseContext'
|
||||
username = 'sa'
|
||||
password = 'isadmin'
|
||||
cnxn = pyodbc.connect(
|
||||
'DRIVER={/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1};SERVER=' + server + ';' +
|
||||
'DRIVER=' + driverFrom.get('lxc') + ';SERVER=' + server + ';' +
|
||||
'DATABASE=' + database + ';UID=' + username + ';PWD=' + password + ';Encrypt=no')
|
||||
|
||||
messageTo = {'sam': '331491581', 'is': '-1001637207513'}
|
||||
|
||||
def main():
|
||||
with open('datetime.json') as json_file:
|
||||
date = json.load(json_file)
|
||||
strDatetime = json.load(json_file)
|
||||
date = datetime.fromisoformat(strDatetime) + timedelta(microseconds=10)
|
||||
#MS SQL хранит на одно значение больше в микросекундах, поэтому 713372 (Python) < 7133722 (MS SQL)
|
||||
|
||||
|
||||
cursor = cnxn.cursor()
|
||||
cursor.execute("SELECT Id, Title, Body, DateCreate FROM Newses "
|
||||
|
Loading…
x
Reference in New Issue
Block a user