mrs.bassim
mrs.bassim

Reputation: 479

date converted to Arabic numbers when app's language is Arabic

My app has two languages .. Arabic and English ..

And am getting todays date like this:

var todaydate = ""
var today = Date()
var formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
todaydate = formatter.string(from: today)

this returns in English:

2018-06-04

and in Arabic:

٢٠١٨-٠٦-٠٤

I want to be always in English numbers like 2018-06-04

How to do that?

Upvotes: 3

Views: 1026

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100503

Can you try setting local

formatter.locale = Locale(identifier: "en")

Upvotes: 1

Related Questions