question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No Example of using DateTime Column

See original GitHub issue

Happy to find this great package I have implemented it in production! 🎉 But even after extensive searching I failed to find an example stating how to use DateTime Column. I don’t know if this is the correct place to ask this question. Any help would be greatly appreciated. 🙇
Found this in the docs

Formats a datetime from the item. Can specify a datetime_format to use, which defaults to ‘short’, which is passed to babel.dates.format_datetime.

Could someone please post a minimal working example of DateTime ? My current Columns show time in the long format including pico seconds (maybe)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
CT83commented, Mar 19, 2018

Yip! This issue can be closed! Thanks for all your help.

2reactions
plumdogcommented, Mar 11, 2018

I agree a proper example would be well worth adding.

Basic usage would look something like:

class MyTable(Table):
    datetime = DatetimeCol(
        'DateTime Heading',
        datetime_format="YYYY-MM-dd hh:mm")

items = [dict(datetime=datetime.datetime.now())]
mytable = MyTable(items)

The argument you pass as datetime_format is passed on to Babel’s format_datetime as the format argument, defaulting to "short".

So what it actually displays depends the current locale. If you pass a custom format, Babel uses different letters to .strftime for formatting.

Which is all a touch opaque, really, and worth my documenting properly.

Hopefully that’s helpful for the time being. If there’s still something not clear or not working for you, let me know and I’ll try to help, and get the documentation updated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

section a datetime column by just dates, not time
I have two dataframes. Dataframe 1 is indexed by a DATETIME column. The format is YYYY-MM-DD HH:MM:SS. Dataframe 2 has just one column,...
Read more >
Using the Date/Time Extended data type - Microsoft Support
The Date/Time Extended data type stores date and time information and is similar to the Date/Time data type, but it provides a larger...
Read more >
11.2.2 The DATE, DATETIME, and TIMESTAMP Types
The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in '...
Read more >
DATETIME data type - IBM
The declaration of a DATETIME column need not include the full YEAR to FRACTION range of time units. It can include any contiguous...
Read more >
Time series / date functionality — pandas 1.5.2 documentation
In [1]: import datetime In [2]: dti = pd.to_datetime( . ... The unit parameter does not use the same strings as the format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found