
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to get current date and time from internet in iOS?
Working with date and time can be tricky, I’ve seen new programmers struggling with date and time. In almost all the application you will be required to get the date and multiple operations are dependent on it.
Here we will be seeing how to get the current date and time in swift.
In this post we will be seeing how to get the current time and UTC time.
For getting the UTC time, paste below code in playground.
let utcDate = Date() print(utcDate)
If you wish to get the time stamp of your location, paste the below code in playground.
let dateObj = Date() let datetformatter = DateFormatter() datetformatter.timeZone = TimeZone.current datetformatter.dateFormat = "yyyy-MM-dd HH:mm:ss" print(datetformatter.string(from: dateObj))
- Related Articles
- How to get current date and time from internet in android?
- How to get the current date and time from the internet in Android using Kotlin?
- How to get current date and time in Python?
- How to get current date and time in JavaScript?
- How to get current time and date in C++?
- How to get the current date and time in Java?
- How to get current date and time using JavaScript?
- How do I display the current date and time in an iOS application?
- How to get the current local date and time in Kotlin?
- How to get current date/time in seconds in JavaScript?
- How to Get Current Date and Time in Various Format in Golang?
- Get current time and date on Android
- Python Pandas - Get the current date and time from Timestamp object
- Java Program to Get Current Date/Time
- How do I get the current date and time in JavaScript?

Advertisements