Swift NSDate get current date but strip Year, Month, and Day

RubberDucky4444

I am trying to get the current date using swift. I have that taken care of but it gets the year month and day and I really only want the current hour and minute. The reason being is that I am trying to later on compare a created date that only has an hour and minute. I am currently just using this

let currentDate = NSDate()

Thank you

rob mayoff
let calendar = Calendar.autoupdatingCurrent
let components = calendar.dateComponents([.hour, .minute], from: Date())
let hour = components.hour
let minute = components.minute

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

NSDate get year/month/day

Trying to get the current date as just month, day and year

NSDate day of the year (swift)

php date() not receiving year, month, day: NSDate to php

How to get current date, month, year in scala

Get Current month and year from FSCalender -Swift

Generate NSDate from day, month, and year

Creating NSDate from month, day and year

How to get Date, Month and Year into Millisecond in swift

SQL Query to get the first day of the month passed in the parameer of the current year

Get all list of month and year from given date to current date

Swift - Get date from day of year

Swift 3 Easy way to truncate Date to start of the day/month/year

Swift - Getting Date from Month, Day, Year Components

How to show ~year(s) ~month(s) ~day(s) has been passed using NSdate- swift IOS

Get current month/year and next month/year?

how to get year month day from long date?

How to get relevant month and date by inputting only the day of year in python

How to get day,month,year from String date?

get day month year from java.sql.date

How to get year/month/day from a date object?

How to get the date of a specific day in every month and year?

MySQL: Get date based on the nth day of the week on a particular month/year

How to get a Date object from year,month and day?

How to get a half of every month from current year in Swift

Get day/month from new Date(date) getting current day/month

Get date from day/month/year and then get the name of the day (from generated date)

Get month by week, day and year

Get date object for the first/last day of the current year