How to customize your date according to Timezone in Swift 5

What if we want to unite time in different country for all users that install our app. Yes we can use one timezone for all users. Example we use Asia/Jakarta timezone then everyone who install our app will get same time. But you have to work together with your API developer, so API will send same timezone to all users. And in our app we will get it and convert it. It's not difficult to do it. I will show you how.

I use swift 5, because that's latest one. I haven't used objective-c because no project that write use it. Swift actually more simple than objective-c but it's same. It uses iOS OS. Xcode is helpful tool to write iOS app. But if you use xamarin, it will be ok but the language is not same at all. You need to research again.

You need to understand basic thing about timezone. What is your timezone in your country ? you need to know UTC and GMT because iOS use these.

So in this code, I show you two different way to customize your timezone, first I use timezone identifer and timezone offset. I prefer to use identifier because it's easy to read the code. But if you use timezone offset you need to set seconds but it's ok if you use minutes. You just need to do multiplication. Choose what you like :D. Ok so if have any question please free to ask.

Popular posts from this blog

How to get thumbnail from video URL in Swift 5

Missing system image Android Studio solution