I'm new in Python and trying to learn MySQL
as we import pymysql
import pymysql
from datetime import datetime
conn = pymysql.connect(
host = 'localhost',
user = 'root',
password = '',
database = 'test'
)
mycursor = conn.cursor()
sql = "INSERT INTO led (id,name,date) VALUES (%i,%s,%d,)"
my question is if we have the values of datatypes id = %i, name =%s and date = %d , what are the %? of datetime, time and timestamp..?
I got errors on inserting data while i don not know that exact %? of the all datatypes. if some one has link to learn these datatypes values %? please share the link or if you get my question please answer... I am inserting data i use functions but got NoModuleError. now(), current_date(),datetime()
please let me know that what are the %? of datetime, time and timestamp..?
I assume '%s' since a properly formatted
DATEliteral is indisposable from '2024-01-25'. (Etc.) If you need, for example, the year last, you will have to convert it before or after feeding it to MySQL.