Questions tagged [str-to-date]
123 questions
14
votes
1 answer
Why is TFormatSettings not behaving as expected?
I expect the following code to work:
program Project3;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
var
FS: TFormatSettings;
const
DF = 'yyyymmdd';
begin
try
WriteLn(FormatDateTime(DF, Now));
FS :=…
![](../../users/profiles/2044.webp)
Nick Hodges
- 15,957
- 9
- 59
- 120
4
votes
1 answer
MySQL STR_TO_DATE and timezone
My system timezone is UTC+3.
When I work with timestamp columns in MySQL, they are output for my timezone. So if a timestamp column has 00:00 UTC, it is shown as 03:00 for me.
I need to fill timestamp column with values using STR_TO_DATE.
For…
![](../../users/profiles/2947812.webp)
Mikhail Batcer
- 1,536
- 2
- 28
- 49
4
votes
2 answers
mysql STR_TO_DATE not working
I have a table with a varchar column called birthday
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`birthday` varchar(30) COLLATE utf16_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16…
![](../../users/profiles/1999703.webp)
Thinh Phan
- 85
- 1
- 1
- 8
3
votes
2 answers
How to use %U in str_to_date for MySQL
I have a date stored for a weekly metric in a legacy database as a string with this format:
2010 10 which was crafter with the %Y %U format (i.e years followed by week number)
So I try to reverse it into a datetime column by doing …
![](../../users/profiles/1185460.webp)
allan.simon
- 3,200
- 3
- 27
- 46
3
votes
2 answers
MySQL STR_TO_DATE() function returns null
I wanted to convert my date format From MMMM dd,yyyy to yyyy-MM-dd.
I tried using the following:
SET @dt_to = STR_TO_DATE(dateTo, '%d-%m-%Y');
but returns a NULL value.
How will I convert my date to yyyy-MM-dd format in MySQL?
EDITED:
I am creating…
![](../../users/profiles/2328071.webp)
ThEpRoGrAmMiNgNoOb
- 1,176
- 2
- 21
- 41
2
votes
1 answer
How to convert a string date in european format to a valid mysql date format?
I am trying to insert 2 dates through a form in my database, date format in the form is a string like this 01/01/2020 and the field in the database is DATE so I understand it will take YYYY/MM/DD right?
I have trid this query :
INSERT INTO…
![](../../users/profiles/11755420.webp)
jesus fernandez
- 305
- 1
- 9
2
votes
1 answer
spark dataframe column string to date
I would like to convert a spark dataframe string column of 'yyyyMMdd' to date format with spark session (spark) - not spark context.
Since I'm not working with spark context (sc), I cannot use the following code, although it would precisly do what…
![](../../users/profiles/9642695.webp)
C.Tomas
- 193
- 3
- 11
2
votes
1 answer
Date format in Informix
Is it possible to print the date in the below format in Informix DB,
May 19 1993 12:00AM ?
Consider the below eg.,
If I shoot the below query,
select sysdate from systables;
It displays as,
2017-12-15 05:00:47.24318
But I want the output to be…
![](../../users/profiles/8164380.webp)
Peter.Fox
- 41
- 1
- 1
- 5
2
votes
2 answers
Can't create mysql table due to Incorrect datetime value "..." for function str_to_date
The following query works
select date(str_to_date("08-Nov-2005 22:07","%d-%M-%Y %H:%i:%S"))
As expected, it returns
2005-11-08
The following query also works
select date(str_to_date("XXXX","%d-%M-%Y %H:%i:%S"))
As expected, it returns
NULL
I…
![](../../users/profiles/1007922.webp)
kane
- 4,242
- 3
- 31
- 52
2
votes
1 answer
MySQL STR_TO_DATE for strings with just month and year or just year
I have a column called ReleaseDate (which is a string). Most of them are in the form of %e %M %Y (25 May 1979), but there are a few where it is just %M %Y (May 1979) or %Y (1979). Unfortunately, it doesn't seem the STR_TO_DATE works with just %M %Y.…
![](../../users/profiles/1911612.webp)
rjbogz
- 810
- 1
- 15
- 32
2
votes
1 answer
STR_TO_DATE discrepancy between MySQL 5.5 and MySQL 5.6
This SQL returns a DATE in MySQL 5.5 but NULL in MySQL 5.6. Why?
select date(STR_TO_DATE('2015-01', '%Y-%m')) + INTERVAL 1 DAY;
Here's a SQL Fiddle for MySQL 5.5 and 5.6. STR_TO_DATE returns a date in both instances. Converting the result using…
![](../../users/profiles/5503207.webp)
Nice Guy IT
- 87
- 1
- 7
2
votes
3 answers
select data from mysql using two column ranges
I have data like this
sno name date time
1 Irona 2016-01-01 10:00:00
2 Meona 2016-01-02 21:00:00
3 Lessa 2016-01-02 8:00:00
4 Airik 2016-01-03 10:00:00
I m trying query like this
SELECT * FROM `appointment` where…
![](../../users/profiles/3640494.webp)
user3640494
- 61
- 7
2
votes
1 answer
Is there any way to cleanse column having different date formats in mysql
I need to cleanse a column in a table having different date formats.
eg :
%d-%b-%y, %Y-%B-%d, %d/%m/%Y, %d%b%y, %Y-%b-%d, %Y-%m-%d, %d %b %y, %m/%d/%Y
and so on
Now i need to convert all date values to uniform format like **
%Y-%m-%d
**.
![](../../users/profiles/4423622.webp)
MaDHaN MinHo
- 519
- 5
- 22
2
votes
3 answers
mysql DATE_FORMAT STR_TO_DATE date subquery
Here is the RECORDS MySQL TABLE:
ID - BIGINT(20)
DATE - DATE
Records:
ID Date
1 2014-03-01
2 2014-03-02
3 2014-04-01
4 2014-04-02
Here is the first Query:
SELECT id, DATE_FORMAT(date,'%d/%m/%Y') AS date FROM records
WHERE
date >=…
![](../../users/profiles/3623185.webp)
eXtreme
- 212
- 3
- 16
2
votes
5 answers
SQL Statement Convert it to 1 to Jan, 2 to Feb and so on
As you seen the image below, the month is now 1 and 2. How can I convert it to 1 to Jan, 2 to Feb and so on. Below are my sql.
Help will be appreciate. Thanks in advance! :)
SELECT DISTINCT fbmenuname,
Sum(quantity) …
![](../../users/profiles/3188711.webp)
newbieinjavaversion2
- 449
- 5
- 12
- 23