Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DateTime fields only show date, not time?
Message
From
13/01/2005 04:55:29
Filip Bruman
Kirschberg Holding
Copenhagen, Denmark
 
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
DateTime fields only show date, not time?
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00976686
Message ID:
00976686
Views:
47
Hi!

When binding the DataSet (we use untyped DataSets) to a grid only the date part of the DateTime is shown. The table in the DB has both date and time (field is of type datetime).
Setting a breakpoint before the binding to the grid and writing
ds.Tables[0].Rows[0].ItemArray
lists all the fields in that table row, but the DateTime field only shows the date part!
...

[3]: {1354}
[4]: {10/15/2002}
[5]: {System.DBNull}

...
Writing
ds.Tables[0].Rows[0].ItemArray[4]
it lists the total struct of the DateTime. Both the date and time part of the DateTime is clearly visible.
{10/15/2002}
    System.ValueType: {System.DateTime}
    Date: {10/15/2002}

    ...

    Day: 15

    ...

    Hour: 8

    ...

    Millisecond: 0

    ...

    Minute: 30

    ...

    Month: 10

    ...

    Second: 22

    ...

    Year: 2002
Does anyone know how to get the grid to show both the date & time part in the grid? Or maybe just why it behaves like this?

-Filip
Reply
Map
View

Click here to load this message in the networking platform