Code Monkey home page Code Monkey logo

instant's People

Contributors

akushwarrior avatar bsutton avatar georgiossalon avatar lightrabbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

instant's Issues

The 12 hour time formatter is wrong

When I have a time of 12:50 (24 hour time format) it shows it as 12:50 AM which is 0:50 in 24 hour time format... Please fix this issue when you can. It's a pretty simple one as well.

How to create a specific datetime in a specific zone

All the classes I can find seem to do a 'conversion' of a local datetime to a specific zone.

I know the time in the zone I just need to create a DateTime instance from that.

Essentially I have a time in a string:
2020-10-27 06:10:05+00:00

I need to parse the string into a datetime.

I'm currently doing
expiryDate = DateTime.parse('2020-10-27 06:10:05+00:00');

But I would like to do something like:
DateTime dt = dateTimeWithZone(2020, 10, 27, 06, 10, 05, 'GMT');

Not working while converting IST to EST

DateTime myDT = DateTime.now();//Current DateTime
print("current time :- ${myDT}");

//current time :- 2022-03-24 17:44:12.158026

DateTime EST = dateTimeToZone(zone: "EST", datetime: myDT);//DateTime in EST zone
print("EST time :- ${EST}");

//EST time :- 2022-03-24 07:14:12.158026Z

this is my code. And right now I check EST zone time on Google it's 8:14 .
Why I m getting difference?

How to convert a time to the current timezone

I have a datetime in gmt and need to print it out in the local timezone.

I thought I could do something like:

var gmtTime = DateTime.parse('2020-10-27 06:10:05+00:00');
var offset = DateTime.now().timeZoneOffset; /// this is a duration
dateTimeToOffset(datetime: expiryDate, offset: offset) // this is a double?

I'm really not a big fan of using doubles as the lack a unit.
Dart has really formalised Duration so I would expect this type of library to also use it.
The above impedance mismatch also causes problems.

The doco also doesn't state what unit the double is in. I'm guessing its hours?

I end up with:

var gmtTime = DateTime.parse('2020-10-27 06:10:05+00:00');
var offset = DateTime.now().timeZoneOffset; /// this is a duration
var hours = offset.inHours + offset.inMinutes / 60;
dateTimeToOffset(datetime: expiryDate, offset: hours) // this is a double?

But given the library is meant to make things easier ;<

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.