INVALID_FUNCTION_ARGUMENT: Invalid format: "13-12-2022" is malformed at "-12-2022"

0

Hi, I'm trying to convert a string into a date. The format from the string is 13-12-2022 (or for example 4-12-2022). I've used the follwing query:

, date_parse(Openingsdatum, '%d/%m/%Y')

In which Openingsdatum refers to the string colum of the dates. I figured out that the query uses tho format %m%d%y, so it switched. Could somebody explain why I'm getting this error?

질문됨 2년 전879회 조회
1개 답변
0
수락된 답변

I believe you just need to replace the / with -.

I tried running the below statement with "13-12-2022" and "4-12-2022" . It works

select date_parse('4-12-2022', '%d-%m-%Y') as does_it_work
profile pictureAWS
답변함 2년 전
  • That would've been very easy but unfortunately I still got an error. A different one this time: SYNTAX_ERROR: line 25:3: Unexpected parameters (varchar, varchar(8)) for function date_format. Expected: date_format(timestamp with time zone, varchar(x)) , date_format(timestamp, varchar(x)) This query ran against the "db_retail_datascientists" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: cd450b06-454d-4cb4-9719-b5a01e63e375

  • I'm sorry, wrong error haha. This is the error which I got. But I think I can fix this: INVALID_FUNCTION_ARGUMENT: Invalid format: ""

    Thank you!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠