How to get the current time as datetime

Just started with the playground. I’m trying to create a simple app.

I’ve created a date object like this:

var date = NSDate()

How can I get the current hour? In other languages I can do something like this:

var hour = date.hour

But I can’t find any properties/methods like that. I’ve found a method, dateWithCalendarFormat. Should I use that? If so, HOW?

28 Answers
28

Leave a Comment