Q:

MYSQL remove hyphen then get first numbers of characters of current date

Just like the title described, I would like to get first numbers of characters (for example 6 characters) of current date without hyphens. Something like this:
2018-12-04 becomes 201812

I tried this:
SELECT SUBSTRING(REPLACE(CURDATE(), "-", ""), 0, 6)

But returns empty. But when I do this, I get a result, which is 20181204:
REPLACE(CURDATE(), "-", "")

Is it not possible using nested mysql function like that? Are there any alternatives to that? Please help.

A:

String positions in MySQL start at 1. So you actually need
SELECT SUBSTRING(REPLACE(CURDATE(), "-", ""), 1, 6)

