I've got some timers that measure the time to execute code.
DateTime startTimeFunctionTotal = DateTime.Now;
for (int i = 0; i < array.Count; i++) {
DateTime startTimeFunction = DateTime.Now;
//some code here
DateTime stopTimeFunction = DateTime.Now;
TimeSpan durationTimeFunction = stopTimeFu...
I am trying to create a Stored Procedure that will be used for a Report and I want the 2 date parameters to have a DEFAULT value of today's date and 1 month prior.
Is the below the proper way to do this? I was reading elsewhere that I should use COALESCE...(SEE HERE)This is a touchy production system so I wanted to double check before ...
I am working on an algorithm in C# to calculate a past DateTime based on an input string with the following characteristics:
The string contains an integer followed by either 'D', 'M' or 'Y', such as "1D" or "90M".
The output will be DateTime.Now minus the corresponding number of days, months or years.
The issue I am having is that if...
One of our developers used this call:
TzSpecificLocalTimeToSystemTime() but unfortunately we cannot keep it as the code must work on Win2K as well.
What alternatives are there for similar functionality?
...
Hi!
How can I get the current hour, minutes, and seconds from this?
NSDate *now = [NSDate date];
Thanks! I want to have 3 int variables with the values stored in them, not a string which displays the values.
...
I am developing a component in Joomla. Through my component I want to store timestamp to "lastaccessed" field.
My problem is that, if I am simply storing the date, then MySQL is displaying it as "0000-00-00 00:00:00"
I am using the PHP date function like this:
$row->date_lastaccessed=date();
How can I store and retrieve the date in ...
Hi,
I'm trying to let users type in date and time values into an input field. Some examples may include:
Tomorrow at 3pm
Now
Today at 1pm
Next tuesday 4pm
How would I go about parsing such readable text into date/time strings?
E.g. dd/mm/yyyy hh:mm
Can it be done client-side using jquery or must it be done ajax through php?
Thank...
When compiling a Visual Studio 2005 project that references a mix of c++ managed/unmanaged code, I get the following error:
1>LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc80-mt-1_42.lib'
I have followed the "Getting Started Guide" at http://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html. Of relev...
I need to find out average age of items (groupped by various criteria, but it does not seem to be the issue). However I fail to find how to effectively create aggregation over DateTimeField using Django (on top of MySQL).
Pure Item.objects.all.aggregate(Avg('created')) seems to produce absolutely bogus values (eg. 20081988007238.133) an...
I have a starts_at field that keeps a timestamp with the moment something starts. Also, I have another field seconds_long that represents the amount of seconds that the event lasts.
I need to select all unfinished events but I just can't find a way to sum the starts_at and seconds_long fields. I first tried to sum them, expecting Doctri...
I have a UNIX-type timestamp stored in an INT column in MySQL. What is the proper way to retrieve this as a MySQL DATETIME?
(I found the answer when re-scanning the MySQL Date functions, but didn't see the answer on SO. Figured it should be here.)
...
I currently have a date in this format
2010-03-03 10:39:18
which is a TIMESTAMP field in MySQL. I need to have the date in this format for a search engine called Solr:
1995-12-31T23:59:59Z
Here is some text from their website about dates:
Solr expects dates to be in UTC when
indexing. The format for this date
field is of t...
I'm trying to Parse dates entered into a TextBox into a DateTime value but I keep getting an exception in the TryParseExact method. What I'm trying to do is:
DateTime.TryParseExact(tbAddDate.Text.Trim, "yyMMdd", New CultureInfo("sv-SE"), DateTimeStyles.None, row.Date)
This throws an InvalidCastException with the message "Conversion fr...
I have a date I'm reading from an API in the following format:
2010-03-15T00:00:00-04:00
When assigned to a date datatype in C#/VB.net, it's displayed as:
3/14/2010 11:00:00 PM //Note 3/15 is being displayed as 3/14
why is this displayed as the previous day? Is there a name for the format above?
...
In my application I need to calculate shifts using a pattern described in a file.
Recently, at one of my customers the application was hanging because of the following reason:
If you fill in a 'struct tm' with the exact moment at the end of the wintertime (non-DST) _mktime seems to return an incorrect result.
The code looks like this:
...
t1 = datetime.time(12, 10, 0, tzinfo=GMT1()) # 12:10
t2 = datetime.time(13, 13, 0, tzinfo=GMT1()) #13:13
t3 = datetime.time(23, 55, 0, tzinfo=GMT1()) #23:55
t4 = datetime.time(01, 10, 0, tzinfo=GMT1()) #01:10
I need the minute interval between between two times. For instance a non working one:
def minute_interval(start,end):
re...
I have a date in YYYYMMDD format and a time in HHMMSS format as strings in the 4th and 5th elements in a list. I.E.:
data[4] = '20100304'
data[5] = '082835'
I am creating an instance of datetime (in a field named generates) like this:
generatedtime = datetime.datetime(int(data[4][:4]),int(data[4][4:6]),int(data[4][6:]),int(data[5][:...
Using Python I would like to find the date object for last Wednesday. I can figure out where today is on the calendar using isocalendar, and determine whether or not we need to go back a week to get to the previous Wednesday. However, I can't figure out how to create a new date object with that information. Essentially, I need to figu...
I have a list of data that is a schedule. Each item has a time that it takes place in. I want to detect the current day and time and then display what items are available during that time. All I really know is how to get todays date and time and that I need to create a method to look in my data at what is currently "playing". Any sug...
Hi, I'm trying to create a simple function which returns me a date with a certain number of subtracted days from now, so something like this but I dont know the date classes well:
<?
function get_offset_hours ($hours) {
return date ("Y-m-d H:i:s", strtotime (date ("Y-m-d H:i:s") /*and now?*/));
}
function get_offset_days ($days) {
...