You probably use shapefile format. Otherwise it should have worked.
According to the documentation shapefile format doesn't store date and time in the same field. You need to add date and time to seperate columns or use other format like GeoPackage.
I tried to use a csvt file (like documented at https://anitagraser.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/) to force the type when adding "Delimited text layer". If I tick the "Detect field types" or not, I get the same issue as you: no clues why too...
To get what I want, I have to go another way.
I create your sample file ...
"Any Python datetime function can be used to calculate a date"
#import arcpy, datetime
fc = r'C:\data.gdb\features123'
date_field = 'datefield'
now = 'datetime.datetime.now()'
(Your questions is better suited for stackoverflow.com)
But try using pd.to_datetime and pd.DateOffset:
import pandas as pd
filename = r'/home/bera/Downloads/MCD43A3_Alb_QA_SWIR_2020_061.tif'
d = os.path.splitext(full_path_and_filename).split('_')[-2:] #['2020', '061']
d = pd.to_datetime(d, ...
I did not find a function for adding hours to a date so here's a workaround expression:
format_date(make_datetime(year(now()), month(now()), day(now()), hour(now()) - 6, minute(now()), second(now())),'dd/MM/yyyy HH:mm:ss')
arcpy.SelectLayerByAttribute_management expects you to specify a field based SQL as the where_clause. Your cap_date_q.date.year looks like a class property in python not a proper clause. Since you are after only the years, you can use EXTRACT operator, for example:
SelectLayerByAttribute_management(SHP, "NEW_SELECTION", 'EXTRACT(YEAR FROM "...
Basically you have to use .setDate() for QDateEdit and .setTime() for QTimeEdit, not .setDateTime() and convert strings to QTime via QTime.fromString() or to QDate via QDate.fromString().
But: in this case it is a little more complicated, because QtCore.QDateTime.currentDateTime()) is in QDateTime-Format. So in this case, QDateEdit, has to be set using ....
Postgres is case sensitive. The error message tells you that issue_date is not found, and goes as far as suggesting that you may be meaning Issue_date, with a capital I.
To reference an uppercase column name, it must be within double quotes
select "Issue_date" from myTable
You would have to escape it within the query string
sql_base = "select ...
You can use the python datatime module:
str_date = '2019-11-17 15:42:04'
date = datetime.datetime.strptime(str_date, '%Y-%m-%d %H:%M:%S')
In QGIS 3 you can use the following expression:
It's the number of milliseconds since the epoch (1 Jan 1970). You can convert it to an ee.Date object to use various date methods, including formatting for printing.
var modisCollection = ee.ImageCollection('MODIS/006/MOD10A1')