'Amazon Athena unable to convert date to timestamp in query
I would like to convert date value to timestamp format using Amazon Athena Query and used below function to convert ,able to convert some of the dates into timestamp format but not working for some of the date values ,Please find below example
date_parse('10/20/1977','%m/%d/%Y') output is 1977-10-20 00:00:00:000
But for below type of dates showing error:
date_parse('02/29/1977''%m/%d/%Y') output is
cannot parse "02/29/1977":value 29 for dayOfMonth must be in range [1-28]
Solution 1:[1]
1977 (Gregorian calendar) was not a leap year, so there were no 29th of February - there were only 28 days. So you need to fix the data.
Solution 2:[2]
While it works this seems overkill in lot of situations. The same could be obtain like this:
const ReactComponent: React.FC = ({isOpen}) => {
return (
<div>
hello
{isOpen && <div>Im open!</div>}
</div>
)
}
It could become handy for some code clarity but again if the div you display is too complex you can anyway put it in a separate component.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Guru Stron |
| Solution 2 | Ivo |
