logo
down
shadow

DevExpress GridControl, how to make **any** columns that are of type DateTime display in a specific DateTime format?


DevExpress GridControl, how to make **any** columns that are of type DateTime display in a specific DateTime format?

By : ahmedmido
Date : November 14 2020, 04:48 PM
With these it helps About the first question, you need to use DateEditSettings, not TextEditSettings like:
code :
<dxe:DateEditSettings DisplayFormat="dd-MM-yyyy HH:mm:ss.fff"/>
foreach (var column in MyGridControl.Columns)
{
  if (column.FieldType == typeof(DateTime))
  {
    column.ActualEditSettings.DisplayFormat = "dd-MM-yyyy HH:mm:ss.fff";
  }
}


Share : facebook icon twitter icon
How to make devexpress gridcontrol's indicator display text bold

How to make devexpress gridcontrol's indicator display text bold


By : Bre'Shard Busby
Date : March 29 2020, 07:55 AM
wish help you to fix your issue How can I make the display text in devexpress gridcontrol's indicator bold? , We use this code:
code :
_gridView.RowCellStyle += GridViewRowCellStyle;

void GridViewRowCellStyle(object sender, RowCellStyleEventArgs e)
{
    FontStyle fs = e.Appearance.Font.Style;
    fs |= FontStyle.Bold;
    e.Appearance.Font = new Font(e.Appearance.Font, fs);
}
_gridView.ShownEditor += GridViewShownEditor;

void GridViewShownEditor(object sender, EventArgs e)
{
    FontStyle fs = _gridView.ActiveEditor.Font.Style;
    fs |= FontStyle.Bold;
    _gridView.ActiveEditor.Font = new Font(_gridView.ActiveEditor.Font, fs);
}
_gridView.CustomDrawRowIndicator += GridViewCustomDrawRowIndicator;
void GridViewCustomDrawRowIndicator(object sender, EventArgs e)
{
    FontStyle fs = e.Appearance.Font.Style;
    fs |= FontStyle.Bold;
    e.Appearance.Font = new Font(e.Appearance.Font, fs);
}
dateNow = datetime.datetime.now() causes AttributeError: type object 'datetime.datetime' has no attribute 'datetime'&quo

dateNow = datetime.datetime.now() causes AttributeError: type object 'datetime.datetime' has no attribute 'datetime'&quo


By : cavey001
Date : March 29 2020, 07:55 AM
wish helps you datetime.datetime.now() refers to a method (now) of a class (2nd datetime) of a library (1st datetime), however you didn't import the entire library, just the single class (from datetime import datetime). Either import the entire library or call on the class without referring to the library.
How to make statement `import datetime` bind the datetime type instead of the datetime module?

How to make statement `import datetime` bind the datetime type instead of the datetime module?


By : Jeff Anderson
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further After one too many times having accidentally typed import datetime when what was really needed was from datetime import datetime, I wondered whether it was possible to hack around and make the former do the latter. , Here we go:
datetime.py:
code :
import sys
import imp
import os

path = [p for p in sys.path if p != os.path.dirname(__file__)]
f, pathname, desc = imp.find_module('datetime', path)
std_datetime = imp.load_module('datetime', f, pathname, desc)
# if this^ is renamed to datetime, everything breaks!
f.close()

class CallableModule(object):

    def __init__(self, module, fn):
        self.module = module
        self.fn = fn

    def __call__(self, *args, **kwargs):
        return self.fn(*args, **kwargs)

    def __getattr__(self, item):
        try:
            return getattr(self.fn, item)
        except AttributeError:
            return getattr(self.module, item)

sys.modules['datetime'] = CallableModule(std_datetime, std_datetime.datetime)
import datetime

print(datetime(1, 2, 3))
print(datetime.timedelta(days=1))
print(datetime.now())
0001-02-03 00:00:00
1 day, 0:00:00
2016-05-27 23:16:30.954270
C# DevExpress GridControl : how to make search according to specific column text

C# DevExpress GridControl : how to make search according to specific column text


By : Mohd Saidi Ahmad
Date : March 29 2020, 07:55 AM
it fixes the issue DevExpress grid offers this functionality out of the box.
You just need to display the AutoFilter row:
Trying to convert column headings which are in datetime.datetime format 2016-09-01 00:00:00 to datetime.datetime format

Trying to convert column headings which are in datetime.datetime format 2016-09-01 00:00:00 to datetime.datetime format


By : Ganesh
Date : March 29 2020, 07:55 AM
this will help Note that strftime does not function inplace in itself. So, you should probably be doing i=i.strftime('%Y-%m-%d') to see any effect when you print the outputs.
Here's an effective way to accomplish the same process:
code :
df.columns = df.columns.strftime("%Y-%m-%d")
df.columns = df.columns.date
import datetime

mapper = lambda x: x.strftime("%Y-%m-%d") if isinstance(x, datetime.datetime) else x
df.columns = df.columns.map(mapper)
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org