nsdate Questions
4
Solved
I have a subclass of UITextField that is specific to handle Date text. I have a tableviewcell that uses this text field:
let dateInput: DateTextField
Now the controller needs to initialize the t...
3
Solved
Is there any way to print full date with milliseconds?
For example, I'm doing this:
print("\(NSDate())")
But I'm just get this:
2016-05-09 22:07:19 +0000
How can I get the milliseconds ...
Decorum asked 9/5, 2016 at 22:11
5
Solved
I am building my first ReactNative iOS and Android app. I am an iOS coder with Swift and Obj-C. How do I fetch the current date using ReactNative.
Shall I use Native Modules or is there an ReactNa...
Mita asked 17/5, 2016 at 8:49
6
This is my code:
let currentDate = NSDate()
let usDateFormat = NSDateFormatter()
usDateFormat.dateFormat = NSDateFormatter.dateFormatFromTemplate("d MMMM y", options: 0, locale: NSLocale(localeIde...
Bernadinebernadotte asked 15/10, 2015 at 9:38
4
Solved
I need to make a function for calculating the number of weeks of a given year in Swift according to the ISO-week-system (ISO8601). I need the number as an Int. First I figured I need to make an NSD...
4
Solved
When I try to log the current date:
print(NSDate())
or
print(Date())
(in Swift 3)
Or any date object, it shows the wrong time. For example, it's about 16:12 now, but the above displayed
...
7
Solved
I have data in the format
time: 13:52, 10:30, 11:48
etc
I would like to round to the nearest hour.
like for 13:52 -> 14:00 , 10:30 -> 11:00 and 11:48 -> 12:00.
How can I do that with NSDate?
...
Inflow asked 10/6, 2013 at 7:3
8
Solved
I’m creating a date using NSDateComponents().
let startDate = NSDateComponents()
startDate.year = 2015
startDate.month = 9
startDate.day = 1
let calendar = NSCalendar.currentCalendar()
let startDa...
Sotted asked 12/9, 2015 at 8:5
5
Solved
I would like to check if the user has selected the 12-hour or 24-hour clock as their preference in OS X and iOS. So I would like to detect if the user has done the following:
On the Mac, the Syst...
Deppy asked 27/1, 2015 at 3:26
8
Solved
Seems like a simple thing but I can't seem to find a way to do it.
It would be great to see a couple different methods.
Matador asked 5/4, 2010 at 17:10
12
Solved
I'm trying to get the first and last day of the month in swift.
So far I have the following:
let dateFormatter = NSDateFormatter()
let date = NSDate()
dateFormatter.dateFormat = "yyyy-MM-dd"
let ...
Centrality asked 9/11, 2015 at 9:17
25
Solved
How will I convert this datetime from the date?
From this: 2016-02-29 12:24:26
to: Feb 29, 2016
So far, this is my code and it returns a nil value:
let dateFormatter = NSDateFormatter()
date...
Athwart asked 29/2, 2016 at 13:2
12
Solved
How do you create a date object from a date in swift xcode.
eg in javascript you would do:
var day = new Date('2014-05-20');
12
Solved
I would like to check if a NSDate is before (in the past) by comparing it to the current date. How would I do this?
Thanks
Violaviolable asked 7/11, 2014 at 18:9
20
Solved
How can we measure the time elapsed for running a function in Swift? I am trying to display the elapsed time like this: "Elapsed time is .05 seconds". Saw that in Java, we can use System....
Manson asked 15/7, 2014 at 10:14
9
Solved
Is there a date-only (no time) class in Swift? (or Foundation classes)
(as an aside if there is not but there is a well-known/popular open-source library that implements this if you could mention t...
3
Solved
I need Objective C method for converting Gregorian date to Julian days same as this PHP method (GregorianToJD).
Cabbageworm asked 3/4, 2014 at 6:36
11
Solved
2
Solved
I have built a method that imports a sleep sample but I can't get it to return the proper value for hours asleep.
The method to query for sleep data looks like this:
func updateHealthCategories(...
3
I need to convert Cocoa NSDate to C# DateTime and vice versa.
I am using the following method to achieve this:
public static DateTime NSDateToDateTime (Foundation.NSDate date)
{
DateTime refe...
8
Solved
Possible Duplicate:
How can I compare two dates, return a number of days
I have two dates (as NSString in the form "yyyy-mm-dd"), for example:
NSString *start = "2010-11-01";
NSString *end...
Chamberlain asked 1/1, 2011 at 20:42
2
Solved
I have to format the date string (UTC format) as per device locale settings. For example in India it should display as 08/09/2017 12.23 and in US it should display as 09/08/2017 12.23, Based on dif...
Tantara asked 8/9, 2017 at 19:26
11
Solved
How can I get local date and time in Swift?
let last_login = String(NSDate.date())
4
Solved
I'm creating a countdown timer that counts down to an NSDate set in a UIDatePicker. I have a label that shows the date we're counting down to and that works fine.
What I'm also trying to add is la...
4
Solved
I have an array of dates. I need to find the latest one. Can someone show me an example?
1 Next >
© 2022 - 2025 — McMap. All rights reserved.