Modify Dataset when Viewed in DataGrid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cday119
    New Member
    • Mar 2008
    • 29

    Modify Dataset when Viewed in DataGrid

    Hey

    In my database I have time formatted as a unix timestamp. I put that into a dataset. What is the best way to change those timestamps into a human readable date and time when the dataset is viewed in a datagridview.

    FANK!!!
    Chad
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    Code:
    private function ConvertTimestamp(byval timestamp as double) as DateTime
    {
        'create a new DateTime value based on the Unix Epoch
        dim converted as DateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0)
        converted.AddSeconds(timestamp)
        return converted.ToLocalTime()
    }
    This should convert your timestamp for you

    Comment

    Working...