Giter Site home page Giter Site logo

Comments (7)

garrettgman avatar garrettgman commented on September 20, 2024

to self: % doesn't seem to work, but # does

from lubridate.

garrettgman avatar garrettgman commented on September 20, 2024

also check if there is a time string on the end (which would screw up the # method)

from lubridate.

garrettgman avatar garrettgman commented on September 20, 2024

maybe guess_format could spot time strings and select the correct year format by counting the number of characters in the date object?

from lubridate.

garrettgman avatar garrettgman commented on September 20, 2024

guess_format() has been updated. If a user asks for ymd(x) when x also includes a time string, guess_format() will say that all failed to parse and prompt the user to look for missing or incorrect format elements.

Is this sufficient?
Do you want another function that will make a best determination of any possible format if the user has no clue?

from lubridate.

hadley avatar hadley commented on September 20, 2024

That sounds ok to me.

from lubridate.

garrettgman avatar garrettgman commented on September 20, 2024

Did you want me to make a helper function like ymdhms() for dates with time strings? I'm not sure what we decided at the last meeting (I didn't write it down or see it hear in the issues) :P

It would be difficult to test all the permutations of separators involved, but perhaps we could simplify it by using find_separators() to shorten the list. Or we could allow users to only use time stamps that end with 00:00:00, which seems usual (although sometimes seconds may have decimals). We could then shunt the last 8 characters into strptime and use ymd() on whatever is left over at the beginning.

Or as long as it has separators and is just numbers, we could

  1. use find_separators() to identify separators
  2. use strsplit to divide the datetime into its parts
  3. use a slightly improved new_duration() to turn the datetime into a duration
  4. add that duration to 0 AD to have a date and a time in POSIXt format.
  5. we might have to make some adjustments for leap seconds, but the leap years will take care of themselves. I don't know about daylight savings

Should I work on this?
Should we have a function that would simply separate the date and time components of a date time?

from lubridate.

garrettgman avatar garrettgman commented on September 20, 2024

ps. I like the review tab idea

from lubridate.

Related Issues (20)

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.