Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DateTime fields only show date, not time?
Message
De
13/01/2005 04:55:29
Filip Bruman
Kirschberg Holding
Copenhagen, Denmark
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
DateTime fields only show date, not time?
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00976686
Message ID:
00976686
Vues:
45
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
Répondre
Fil
Voir

Click here to load this message in the networking platform