CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2011
    Posts
    13

    Epoch Time and Date Conversion to Human Readable format

    Dear All,

    Good Evening!

    I am trying to design a form to load the data from csv file which is already done i can see the data in datagrid view but there is one column in datagridview for date it's epoch unix format i am trying to convert it to human readable format using VB.NET in Microsoft excel i have done this by using formula

    =(B2/86400)+25569

    it works fine but i am trying to design a form to view the file and filter the required data based on filter to save sometime because the csv files is having a lot of records.
    So i tried the below code to convert the epoch format to standard date and time but it's showing same value in all cells, if you can help me in this to sort it out. I am calling this function on button clicked event.

    Code:
    Private Sub calculation()
            Dim dt As Date
            Dim i As Integer
            For Each row As DataGridViewRow In DataGridView1.Rows
                If Not row.IsNewRow Then
                    dt = New DateTime(1970, 1, 1, 0, 0, 0, 0)
                    DataGridView1.Rows(i).Cells(4).Value = dt
                    i += 1
                End If
            Next
        End Sub
    Many Thanks in advance.
    Last edited by 2kaud; June 17th, 2018 at 12:09 PM. Reason: Added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured