SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how can I exchange e.Day.Date.ToLocalTime() by the Textbox.Text value.

I have this code:

                    string FullQuery = "<Where><And><Eq><FieldRef Name='{0}' /><Value Type='DateTime'>{1}</Value></Eq><Eq><FieldRef Name='Pracownik' /><Value Type='Text'>{2}</Value></Eq></And></Where>";
                string dateISO = SPUtility.CreateISO8601DateTimeFromSystemDateTime(Convert.ToDateTime(TextBox4.Text).ToLocalTime());
                var query1 = new SPQuery();
                query1.Query = String.Format(FullQuery, Convert.ToDateTime(TextBox4.Text).ToLocalTime(), dateISO, DropDownList1.SelectedItem.Text);
                query1.ViewFields = "<FieldRef Name='Kontrakt' /><FieldRef Name='Procenty' />";
                query1.ViewFieldsOnly = true;

                SPListItemCollection listaDniPrzeznaczonychNaProjekt = witryna.Lists["Szczegoly"].GetItems(query1);

                foreach (SPListItem olistaDniProjektowych in listaDniPrzeznaczonychNaProjekt)
                    Label4.Text += olistaDniProjektowych["Kontrakt"].ToString();

And I want to put there Textbox.Text

The debuger says me that the same of filds are incorect.

share|improve this question
I done this by adding 2 Hours to days: TextBox4.Text).ToUniversalTime().AddHours(2.0) – Grzegorz Z Oct 31 '12 at 12:21
If this solved your problem, you should post it as answer (within some time you will be able to also mark as answer) – Anders Rask Oct 31 '12 at 13:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.