Q:

How to convert Listview dates to local time zone?

I have 3 columns in the ListView. From,Subject,Date
I'm using the OpenPop library.
private int numberofallmessages = 0;
        private int countMsg = 0;

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            OpenPop.Pop3.Pop3Client PopClient = new OpenPop.Pop3.Pop3Client();
            PopClient.Connect("mail", 110, false);
            PopClient.Authenticate("me", "me",
                OpenPop.Pop3.AuthenticationMethod.UsernameAndPassword);
            List<string> uids = PopClient.GetMessageUids();
            int messageCount = PopClient.GetMessageCount() -1;
            numberofallmessages = messageCount;
            allMessages = new List<OpenPop.Mime.Message>(messageCount);
            for (int i = messageCount; i > 0; i--)//for (int i = messageCount - 1; i > -1; i--)
            {
                if (backgroundWorker1.CancellationPending == true)
                {
                    e.Cancel = true;
                    return;
                }
                string currentUidOnServer = uids[i];
                if (!seenUids.Contains(currentUidOnServer))
                {
                    if (i > 0)
                        allMessages.Add(PopClient.GetMessage(i));
                    SaveFullMessage(PopClient.GetMessage(i), i);
                    w = new StreamWriter(emailsIDSFile, true);
                    w.WriteLine(currentUidOnServer);
                    w.Close();
                    int nProgress = (messageCount - i + 1) * 100 / messageCount;
                    backgroundWorker1.ReportProgress(nProgress, PopClient.GetMessageCount().ToString() + "/" + i);
                }
            }
            PopClient.Disconnect();
        }

        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            pbt.Value = e.ProgressPercentage;
            pbt.Text = e.ProgressPercentage.ToString() + "%";
            pbt.Invalidate();
            label8.Text = e.UserState.ToString();
            label8.Visible = true;
            lvnf.Items.Add(new ListViewItem(new string[]
            {
              allMessages[countMsg].Headers.From.ToString(),         //From Column
              allMessages[countMsg].Headers.Subject,                 //Subject Column
              allMessages[countMsg].Headers.DateSent.ToString()      //Date Column
            }));

            countMsg += 1;
        }

The problem is in the progresschanged event i think. Where i add the items to each column.
When it's adding the emails to the ListView i see it like this:

The problem is on the date column the date is fine but the time in not my time. Not sure of what place the time is but in my place it's now 1:52 AM
How can i get/set the time of my place ?
I couldn't find in the line:
allMessages[countMsg].Headers.DateSent.ToString()

How to change it to my time.

A:

Try this:
allMessages[countMsg].Headers.DateSent.ToLocalTime().ToString();

You want to utilize the DateTime.ToLocalTime() method. It does the heavy lifting for you.
Hope this helps

Edit: Removed incorrect version as the documentation for OpenPop.Net states that the MessageHeader.DateSent property is in fact a DateTime object.

