Questions tagged [date-format]
Used for handling non-default style character-strings representing the date and time. This is predicated on handling date and time styles from different nations and/or languages.
139 questions
6 votes
3 answers
751 views
Unexplained MSSQL default date formatting
I have a problem with T-SQL that is out of my control. Their T-SQL is failing to work with a date that was cast to VARCHAR(10). They are expecting to get the default yyyy-mm-dd (the documented default ...
0 votes
2 answers
564 views
Convert varchar into datetime and use date diff on the where clause
I have a field ABCD stored as varchar(16) and the data stored as 20170509074744CD. I am not versed with SQL Language. I will greatly appreciate any help converting the field ABCD into datetime and use ...
0 votes
1 answer
2k views
Dynamic data used as column name in Amazon Redshift
I am trying to use a year-month dynamic function to use it as a column name in Amazon Redshift. I don't want to write a hardcode for that. The database tool I'm using is DBeaver Ultimate and the code ...
0 votes
0 answers
442 views
How to convert correctly from datetime2 data-type to small date and to elliminate HH:mm:SS.000000 padding
I have created a table with a column with a date data type which correspond to a date data in yyy-MM-dd format. In the database it presents it as if the data type is datetime2(7). More generally all ...
3 votes
2 answers
4k views
Convert Date format to insert into MySQL database
I'm receiving the date in 'Sun Jun 20 00:40:27 IST 2021' format. Which I need to insert to my MySQL database in datetime(6) format. I used STR_TO_DATE('Sun Jun 20 00:40:27 IST 2021','%d/%m/%Y %T') ...
3 votes
1 answer
5k views
Removing leading zeros from month and day
Someone in a PostgreSQL chat room gave me this syntax. It is used in a VIEW that outputs an RSS feed link: to_char(tips_chronic_pain_weekly_selection.start_date, 'YYYY/MM/DD'::text) Example output: ...
0 votes
2 answers
347 views
Using ISO8601 Dates in Oracle
I’m pretty experienced with other SQLs (PostgreSQL, Microsoft Server, MySQL, SQLite), but not so in Oracle. Is there any way to get Oracle to accept date literals in ISO8601 format. For example: ...
0 votes
1 answer
785 views
Given a table with date_time column, how to run a query using only the date
I have a DB with a table which has a column datetime Date_Time. The format of this is for example: 2021-09-01 13:15:16. I would like to set a query that is indipendent of the time but just consider ...