Giter Site home page Giter Site logo

amdkholil / id-timezone Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 8 KB

Dart Package: Easy to change any time zone to Indonesian time zone.

Home Page: https://pub.dev/packages/indonesian_timezone

License: MIT License

Dart 100.00%
dart dart-package dart-app dart-packages flutter-package flutter-packages

id-timezone's Introduction

Indonesian Timezone

Simple package to cange and format Datetime or parsing String to Datetime to Indonesian Timezone (WIB, WITA, WIT)

  • change Datetime to Indonesian Timezone & format it with easy
DateTime dateTime = DateTime.now();

// IdTimezone idTimeZone = IdTimezone(date: dateTime, utc: UTC.zero);
IdTimezone idTimeZone = IdTimezone(date: dateTime); // default read UTC±0

// change to Indonesian Time Zone
DateTime? inWIB = idTimeZone.toWIB();

// format to string with custom format
String? inWIBStr = inWIB?.format("dd MMM yyyy HH:mm");
  • parse from string
String dateTimeStr = "2022-01-01 10:00:00";
DateTime? idTz = IdTimezone().parse(dateTimeStr).toWIB();
String? formated = idTz?.format("dd MMM yyyy HH:mm");
print(formated); // 01 Jan 2022 13:00
  • Function & methods
Funtion Param Return Description
.toWIB() - DateTime change to WIB Timezone
.toWITA() - DateTime change to WITA Timezone
.toWIT() - DateTime change to WIT Timezone
.format(String) String String change IdTimezone/DateTime to String with custom format
.parse(String) String datetime IdTimezone parse String to IdTimezone class
.setUTC(UTC) UTC enum IdTimezone set Timezone in UTC format
.fromWIB(DateTime) DateTime in WIB/UTC+7 IdTimezone parse DateTime WIB/UTC+7 to IdTimezone class
.fromWITA(Datetime) DateTime in WITA/UTC+8 IdTimezone parse DateTime WITA/UTC+8 to IdTimezone class
.fromWIT(DateTime) DateTime in WIT/UTC+9 IdTimezone parse DateTime WIT/UTC+9 to IdTimezone class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.