Code Monkey home page Code Monkey logo

datepicker-ios's Introduction

Utils

Using datePicker for multiple textfields in iOS swift

https://stackoverflow.com/questions/49974448/using-datepicker-for-multiple-textfields-in-ios-swift

let dateFormatter = DateFormatter() dateFormatter.dateFormat = "HH:mm:ss" var dateFromStr = dateFormatter.date(from: "12:16:45")!

    dateFormatter.dateFormat = "hh:mm:ss a 'on' MMMM dd, yyyy"
    //Output: 12:16:45 PM on January 01, 2000

    dateFormatter.dateFormat = "E, d MMM yyyy HH:mm:ss Z"
    //Output: Sat, 1 Jan 2000 12:16:45 +0600

    dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
    //Output: 2000-01-01T12:16:45+0600

    dateFormatter.dateFormat = "EEEE, MMM d, yyyy"
    //Output: Saturday, Jan 1, 2000

    dateFormatter.dateFormat = "MM-dd-yyyy HH:mm"
    //Output: 01-01-2000 12:16

    dateFormatter.dateFormat = "MMM d, h:mm a"
    //Output: Jan 1, 12:16 PM

    dateFormatter.dateFormat = "HH:mm:ss.SSS"
    //Output: 12:16:45.000

    dateFormatter.dateFormat = "MMM d, yyyy"
    //Output: Jan 1, 2000

    dateFormatter.dateFormat = "MM/dd/yyyy"
    //Output: 01/01/2000

    dateFormatter.dateFormat = "hh:mm:ss a"
    //Output: 12:16:45 PM

    dateFormatter.dateFormat = "MMMM yyyy"
    //Output: January 2000

    dateFormatter.dateFormat = "dd.MM.yy"
    //Output: 01.01.00

    //Customisable AP/PM symbols
    dateFormatter.amSymbol = "am"
    dateFormatter.pmSymbol = "Pm"
    dateFormatter.dateFormat = "a"
    //Output: Pm

    // Usage
    var timeFromDate = dateFormatter.string(from: dateFromStr)
    print(timeFromDate)

datepicker-ios's People

Contributors

ossab98 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.