Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift 5 only the day number from date

    let dateString = "2018-12-24 18:00:00 UTC"
    let formatter = DateFormatter()
    formatter.dateFormat = "yyyy-MM-dd HH:mm:ss 'UTC'"
    guard let date = formatter.date(from: dateString) else {
        return
    }

    formatter.dateFormat = "yyyy"
    let year = formatter.string(from: date)
    formatter.dateFormat = "MM"
    let month = formatter.string(from: date)
    formatter.dateFormat = "dd"
    let day = formatter.string(from: date)
    print(year, month, day) // 2018 12 24
Comment

PREVIOUS NEXT
Code Example
Swift :: swift qrcode scanner 
Swift :: swift setinterval 
Swift :: how to call app delegate function in swift 
Swift :: swift dismiss keyboard on return 
Swift :: how to loop swift 
Swift :: change the title of a button using Swift 
Swift :: swift animate add subview 
Swift :: convert int to string in swift 
Swift :: navigationbar large title swift 
Swift :: swift add programmatically width height constraint to view 
Swift :: swift array contains 
Swift :: swiftui actionsheet 
Swift :: How to hide view in swiftui 
Swift :: remove all add TapGestureRecognizer swift 
Swift :: user defaults swift 
Swift :: find range of string swift 
Swift :: date format swift 
Swift :: Swift Character Example 
Swift :: swift how to set warning message 
Swift :: swift lazy 
Swift :: swiftui refresh view 
Swift :: Swift Double 
Swift :: Swift Print Variables and Literals 
Swift :: Swift Named Tuple 
Swift :: Swift Library Function 
Swift :: 95 dollars in rupees 
Swift :: do something when your HTTP response finishes. swift 
Swift :: swift dictionary to json string online 
Swift :: get links from string or html a tag swift 
Swift :: spilit string in swift 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =