Is MCOIMAPSearchOperation with searchSinceReceivedDate time specific or granular? - mailcore2

Below is the code I have to do a search using searchSinceReceivedDate.
It will return all the messages for a given date.
I want to know if the method also uses the hour, minute , second portion of the NSDate?
So that I can say I want to retrieve all new messages in the last 5 minutes.
MCOIMAPSearchExpression *dateFilter = [MCOIMAPSearchExpression searchSinceReceivedDate:[NSDate dateWithTimeIntervalSinceNow:seconds]];
MCOIMAPSearchOperation *searchOperation = [session searchExpressionOperationWithFolder:folder expression:dateFilter];
Below is the debug output of the interaction:
2014-08-01 08:36:52.753 myApp[3154:360f] - 1 - 8 UID SEARCH SINCE 1-Aug-2014

The answer I received from the mailcore2 forum was that I am to use the last uuid as a basis for my next search.
This worked for me.

Related

splunk date time difference

I am new to Splunk. My goal is to optimize the API call, since that particular API method is taking more than 5 minutes to execute.
In Splunk I searched using context ID, I got all the functions and sub functions call by main API call function for that particular execution. Now I want to figure what which sub function took the maximum time. In Splunk in left side, in the list of fields, I see field name CallStartUtcTime (e.g. "2021-02-12T20:17:42.3308285Z") and CallEndUtcTime (e.g. "2021-02-12T20:18:02.3702937Z"). In search how can I write a function which will give me difference between these two times. I google and found we can use eval() function but for me its returning null value.
Additional Info:
search:
clicked on "create table view" and checked start, end and diff fields in the left side fields list. but all three are coming as null
not sure what wrong I am doing. I want to find out the time taken by each function.
Splunk cannot compare timestamps in string form. They must be converted to epoch (integer) form, first. Use the strptime() function for that.
...
| eval start = strptime(CallStartUtcTime, "%Y-%m-%dT%H:%M:%S.%7N%Z")
| eval end = strptime(CallEndUtcTime, "%Y-%m-%dT%H:%M:%S.%7N%Z")
| eval diff = end - start
...

how to add days in orient db

How do we add days to dates in Orient db?
select sysdate()+1 from safetyplan;
It is giving same output as sysdate().
1 is not getting added. Can you help me, please?
According to Orientdb doc 2.2:
sysdate() returns the current date time. If executed with no parameters, it
returns a Date object, otherwise a string with the requested
format/timezone.
So one possible way is to convert date object to long using .asLong() method of date object.Then do the necessary addition.Convert it back to date using .asDate() method.
Example:To get a day added to current day use:
select sum(sysdate().asLong(),86400000).asDate() from safetyplan;
Note:we are adding in milliseconds and 1 day=1000*60*60*24 milliseconds
NB:Thought that this answers may help someone and sorry for answering my own question.

How to handle to a certain Date scenario in Selenium script

i have a scenario where on opening the calendar three dates are enabled for the current week lets' say '21,22,23' and then the next day '21' gets disabled and the next dates shown are 22 ,23 ,24 so i would like to handle this in a way so that it would pick the next date automatically the next day. I don"t want to hard code it as the script will fail next day. How should i handle this?Any suggestions. Thanks
Sounds like you need to know the current date, and then the date of tomorrow.
This has been addressed many many times already on Stack Overflow, so search for more details. Also, this seems to be completely unrelated to Selenium, so please edit your Question and its title to correct and clarify.
ZoneId z = ZoneId.of( "Pacific/Auckland" );
LocalDate today = LocalDate.now( z );
LocalDate tomorrow = today.plusDays( 1 );

EWS Managed API: Fetch emails by search filter on DateTimeReceived

While searching for items in the inbox that have been received after a particular time frame (as mentioned in the code below). It searches for the date but it is also returning the email with the specified timestamp. I want the emails only after the specified timestamp.
SearchFilter greaterthanfilter = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived,
Convert.ToDateTime(lastUploadedEmailtimeStamp));
mailItems = inbox.FindItems(greaterthanfilter, view);
Not sure if anyone has faced any similar issues? Basically I want to search for items that were received after a particular mm/dd/yyyy hh:mm:ss.
Exchange stores the datetimes with a precision down to the Millisecond, EWS only give you a precision on datetimes to the second however the Searchfilters do have a precision of milliseconds with Date time. So if you datetime stamps your using only have a precision of seconds then you need to use something like this eg where you wanted all email that was received after 7:43 and 8 seconds
SearchFilter sfs = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived, DateTime.ParseExact("2014/12/29 07:43:08.999", "yyyy/MM/dd HH:mm:ss.fff", null));
FindItemsResults<Item> femaa = service.FindItems(WellKnownFolderName.Inbox,sfs, iItemView);
If you want to look at the actual precision on your messages you need to use a MAPI editor like OutlookSpy of MFCMapi. You can then look at the PT_Systime value which are FileTime "8 bytes; a 64-bit integer representing the number of 100-nanosecond intervals since January 1, 1601" see http://msdn.microsoft.com/en-us/library/ee157583(v=EXCHG.80).aspx
Cheers
Glen

Calculate end date based on # of days and start date

I am working on script where users can make certain type of orders. Now when users make an order they can choose how long they wont it to last in # of days. Once the order is placed I need to approve their order and that approval date is recorded inside my database. Now what I need is to show inside their user panel how much days their package will last since the day of my approval. So for example if I approved their order September 08, 2013 and they choosed for the order to last 7 days, I wont them to see inside they panel for every next day they login how much days they have left, so 7days, 6days, 5days, etc... all the way to "0 Days" when they come to their panel on September 16, 2013.
I have following variables for those two values:
$row_ordersResults['date'] - the date I approved the order
$row_ordersResults['drip_feed'] - # of days they wont for their order to last
I did tried to lots of combinations by myself but I am totally stuck with this and cant make it work.
Thanks for help!
The libraries at momentjs.com is pretty cool. But if you just wanted something simple to calculate the "date difference" between two time values, there is a relatively simple way to do it. I assume you wanted it done in Javascript.
All you need to do is to clear out the hour/minute/second/millisecond fields of the two dates, calculate their differences in days. Put the script below in any web browser and you'll see how it works.
<script>
function foo() {
var d1 = new Date(2013, 8, 12, 13, 40, 1, 333); // any date value, last 4 params can be anything
var d2 = new Date(2013, 9, 3, 11, 42, 32, 533);
d1.setHours(0); d1.setMinutes(0); d1.setSeconds(0); d1.setMilliseconds(0);
d2.setHours(0); d2.setMinutes(0); d2.setSeconds(0); d2.setMilliseconds(0);
daysLeft = (d2.getTime() - d1.getTime())/(24*60*60*1000);
alert('Dear customer, there is(are) ' + daysLeft + ' day(s) left on your order!' );
}
</script>
Show Remaining Days on Order
EDIT: adding PHP version
<?php
$d1 = New DateTime('2013-08-28 06:25:00');
$d2 = new DateTime(); // now
$drip = 55;
$interval = $d2->diff($d1); // time difference
$days_left = $drip - $interval->format('%a'); // in days, subtract from drip
echo "There are $days_left days left\n";
?>
I hope I don't get marked down for not suggesting a specific answer, but time and date calculations are very tedious and JavaScript's Date() provides limited options. So rather than offer some ugly code, I suggest you take a look at moment.js at momentjs.com. Once you attach the script to your pages, you can easily manage all kind of date formats, and set up a function that will allow you to do math on dates and automatically generate your date ranges - it will even let you format them in to user friendly formats like "in 3 days", which I think is what you want. If your app has anything to do with time, and most do, I can't recommend Moment highly enough.