Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save the current date to CoreData?

I have an attribute in CoreData which accepts a date value. I just want to get the current date and save it in this format "dd/mm/yyyy" . But don't know how. Thanks

like image 310
Luke97 Avatar asked Feb 01 '17 11:02

Luke97


1 Answers

If you're storing it as Date, then you have no control over the format until you try to present the returned value somewhere, and you just store Date()

If you're storing it as shown, then you need to use a DateFormatter to create the string you need

like image 59
Russell Avatar answered Sep 21 '22 07:09

Russell