Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

How to get the UTC time? #95

Open
VicFrolov opened this issue Sep 12, 2017 · 0 comments
Open

How to get the UTC time? #95

VicFrolov opened this issue Sep 12, 2017 · 0 comments

Comments

@VicFrolov
Copy link

VicFrolov commented Sep 12, 2017

In momentjs, we simply do moment().utc().format(), how would we accomplish this in SwiftMoment?

For completion, this is what I ended up doing using Date() and TimeFormatter()

    let UTCDate = Date()
    let formatter = DateFormatter()
    formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
    formatter.timeZone = TimeZone(secondsFromGMT:0)
    let utcTime = formatter.string(from: UTCDate)

Thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant