From 568e7757c9171cb16f4fb746c3ef1aac7f816959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Mu=CC=88ller?= Date: Sun, 6 Dec 2020 17:36:10 +0100 Subject: [PATCH] Add getTimeFromDate to NCUtils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Mùˆller --- NextcloudTalk/NCUtils.h | 1 + NextcloudTalk/NCUtils.m | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/NextcloudTalk/NCUtils.h b/NextcloudTalk/NCUtils.h index f61451d1..72869fb8 100644 --- a/NextcloudTalk/NCUtils.h +++ b/NextcloudTalk/NCUtils.h @@ -38,6 +38,7 @@ NS_ASSUME_NONNULL_BEGIN + (NSDate *)dateFromDateAtomFormat:(NSString *)dateAtomFormatString; + (NSString *)dateAtomFormatFromDate:(NSDate *)date; + (NSString *)readableDateFromDate:(NSDate *)date; ++ (NSString *)getTimeFromDate:(NSDate *)date; + (NSString *)sha1FromString:(NSString *)string; diff --git a/NextcloudTalk/NCUtils.m b/NextcloudTalk/NCUtils.m index 246d57ec..5648625e 100644 --- a/NextcloudTalk/NCUtils.m +++ b/NextcloudTalk/NCUtils.m @@ -131,6 +131,13 @@ static NSString *const nextcloudScheme = @"nextcloud:"; return [dateFormatter stringFromDate:date]; } ++ (NSString *)getTimeFromDate:(NSDate *)date +{ + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:@"HH:mm"]; + return [formatter stringFromDate:date]; +} + + (NSString *)sha1FromString:(NSString *)string { NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];