473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DateTime issue

microsoft outlook example is
// Set the criteria for the Date fields.
sCriteria = "[Start] <= '09/01/2002 08:00 AM' and [End] >=
'2/15/2002 08:00 PM'";

my code is as follows where dt=DateTime.Now.Subtract(new
TimeSpan(14,0,0,0,0)):
string Filter = "[To] = 'blahblah.co.uk' and [Subject] = 'RE: yadiya" + "
and [SentOn] >= '" + dt.ToString("MM/dd/yyyy mm:ss tt") + "'";

Outlook.MailItem mi=(Outlook.MailItem)SentFolder.Items.Find(Filter) ;

This fails.
I change the date to have dd/MM/yyyy mm:ss tt, still fails
I change the date to have yyyy/MM/dd mm:ss tt, still fails
If I remove the minutes and seconds plus am/pm stuff and just use date it is
OK. i.e dt.ToString("MM/dd/yyyy")

Why should the time part of the date cause grief?

cheers

Peter

Nov 16 '05 #1
1 2476
Sorted. I was stupid enough to not include an hour element in the format.

cheers
"Pete W" <pe***********@ntlworld.com> wrote in message
news:D3*************@newsfe5-win.ntli.net...
microsoft outlook example is
// Set the criteria for the Date fields.
sCriteria = "[Start] <= '09/01/2002 08:00 AM' and [End] >=
'2/15/2002 08:00 PM'";

my code is as follows where dt=DateTime.Now.Subtract(new
TimeSpan(14,0,0,0,0)):
string Filter = "[To] = 'blahblah.co.uk' and [Subject] = 'RE: yadiya" + "
and [SentOn] >= '" + dt.ToString("MM/dd/yyyy mm:ss tt") + "'";

Outlook.MailItem mi=(Outlook.MailItem)SentFolder.Items.Find(Filter) ;

This fails.
I change the date to have dd/MM/yyyy mm:ss tt, still fails
I change the date to have yyyy/MM/dd mm:ss tt, still fails
If I remove the minutes and seconds plus am/pm stuff and just use date it
is OK. i.e dt.ToString("MM/dd/yyyy")

Why should the time part of the date cause grief?

cheers

Peter

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Max M | last post by:
# -*- coding: latin-1 -*- """ I am currently using the datetime package, but I find that the design is oddly asymmetric. I would like to know why. Or perhaps I have misunderstood how it...
15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
5
by: I am Sam | last post by:
I have created this DateTime object and instanced it I think correctly DateTime myClubNow1=new...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
4
by: luckyabhishek | last post by:
Hi I am using a java webservice in a .NET application. The xml type of a field in this webservice is xsd:datetime. When i call the webservice from the application i get a deserialization error on...
4
by: shaboo | last post by:
Hi Guys, I have just installed Python2.4.2 on our HP-UX system. But when I try to import datetime modlue I get the following error ~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> from datetime import...
1
by: =?Utf-8?B?YXZucmFv?= | last post by:
We have a web service that gets data in xml format. In that Xml data, we parse few date fields that are in this format <data datefield="12/26/2008" timefield="16:33:45" ...> we parse it into a...
3
by: =?Utf-8?B?U2FuZHBvaW50R3V5?= | last post by:
string dateTime = "5/28/2008"; DateTime.Compare(DateTime.Now,DateTime.Now) // returns 0 DateTime.Compare(DateTime.Now,DateTime.Parse(dateTime)) // returns 1 I need to compare 2 dates, using...
10
by: Newbie | last post by:
howdy... i am trying to execute a statement where i insert a record with datetime values into a sql database. Dim sqlcmd As New SqlCommand sqlcmd.CommandText = "update tbl_event set...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.