My entity has a startDate (NSTime) attribute where I use the date and time in my detail display of the entity.
And in my list, I need to group my entities by day (YYMMDD) based on the start date; and I want to ensure that it can adapt to the region where the user is currently (e.g. if user travels or migrate, the YYMMDD should be adapted based on the current region). Does Core Data SectionedFetchRequest supports strftime() functions from SQLite (https://sqlite.org/lang_datefunc.html) or what is an effective alternative sectioned fetch in my case?
I don't think you can use strftime()
directly with Core Data – Core Data supports NSExpressionDescription, hence supports some predefined functions listed here, and strftime()
is not there.
You can achieve your goal by using transient
attribute though. How to do that is demonstrated in this sample code.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.