+ 3
Can we access the special point of something?
I have a database that stores time in this format: year/month/day/hour/minute Can I access just to the hour part?
9 Réponses
+ 1
Maybe you can try to use HOUR function. See this SQL date functions reference:
https://www.tutorialspoint.com/sql/sql-date-functions.htm
+ 3
Thanks a lot Ipang
+ 3
If I wanna get for example day of the date, should I store day in a seperate column or I can have access to it from the format I mentioned above?
+ 3
Yes I got that but if I wanna use your solution,do I have to store day and month in two separate columns?
+ 3
Thank you very much
I got the point completely
+ 2
You're welcome Nika Soltani Tehrani
+ 1
For day in a month use DAYOFMONTH. For day in a week use DAYOFWEEK.
Refer to the link on my previous comment for syntax and example.
+ 1
No, I think you don't necessarily need two columns to separate day and month. Those date functions are there for this reason, so we can extract a particular part of DATE or DATETIME column (if I understood it correctly).
+ 1
You're very welcome Nika,
I'm glad you got it 👍