Time Display

// Created by Azmal Hossain on 11/17/16.
import UIKit

class ViewController: UIViewController{
@IBOutlet weak var displayTimeLabel: UILabel!

// @IBAction func refreshButton(_ sender: UIButton){
 @IBAction func refreshButton(_ sender: AnyObject) {
 let now = NSDate()
 let formatter = DateFormatter()
 formatter.dateFormat = "HH:mm:s a"  //HH-mm-s this way also can
 displayTimeLabel.text = formatter.string(from: now as Date)
 override func viewDidLoad() {
 // Do any additional setup after loading the view, typically from a nib.

 override func didReceiveMemoryWarning() {
 // Dispose of any resources that can be recreated.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s