Set datacolumn to date

RIAS
RIAS used Ask the Experts™
on
Set datacolumn to date in vb.net
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
Your statement is not very clear to me! Can you explain a bit more please?

Author

Commented:
In a datatable I need to change a datacolumn datatype to date rather than datetime.

Author

Commented:
        With dthistory

            .Columns("OriginalValue").ColumnName = "Original Value"
            .Columns("AmendedValue").ColumnName = "Amended Value"
            .Columns("ReasonForChange").ColumnName = "Reason For Change"
            .Columns("DateTimeStamp").ColumnName = "Amendment Date/Time"
            .Columns("ByUser").ColumnName = "Amended By"
            ' .Columns("EventDate").ColumnName = "Event Date"
        End With
        Dim dtCloned As New DataTable

        dtCloned = dthistory.Clone()






        dtCloned.Columns("EventDate").DataType = TypeOf (Convert.ToDateTime(DateTime.ToString(dd - MM - yyyy)
        For Each row As DataRow In dthistory.Rows
            dtCloned.ImportRow(row)
        Next

Open in new window

Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Author

Commented:
   dtCloned.Columns("EventDate").DataType = TypeOf (Convert.ToDateTime(DateTime.ToString(dd - MM - yyyy)
     

Open in new window


Needs change

Thanks
Senior .Net Consultant
Top Expert 2016
Commented:
I am pretty there is no such datatype for a datacolumn. If your concern is only the display, you should format the output.

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial