Hello. I have a question: Is it possible to select form MySQL database by comparing one DATE string "2010-04-29" against strings that are stored as DATETIME (2010-04-29 10:00) ?
I have one date picker that filters data and I would like to query the table by the DATETIME field like this:
SELECT * FROM `calendar` WHERE startTime = '2010-...
I've got a query where I'm trying to get the hours in duration (eg 6.5 hours) between two different times.
In my database, time and date are held in different fields so I can efficiently query on just a startDate, or endDate as I never query specifically on time.
My query looks like this
SELECT COUNT(*), IFNULL(SUM(TIMEDIFF(endTime,...
I need to "construct" .NET DateTime values in Python/C++.
How can I compute the number of ticks stored by DateTime starting from a UNIX timestamp?
A solution involving Win32 API calls it's ok (I believe FILETIME functions could help).
...
I'm currently using an assert statement with isinstance. Because datetime is a subclass of date, I also need to check that it isn't an instance of datetime. Surely there's a better way?
from datetime import date, datetime
def some_func(arg):
assert isinstance(arg, date) and not isinstance(arg, datetime),\
'arg must be a dat...
Hi,
I have a table that looks like this:
----------------------
| DateTime | Value |
----------------------
| 2010-01-01 | 26 |
| 2010-02-01 | 24 |
| 2010-03-01 | 23 |
| 2010-04-01 | 28 |
| 2010-05-01 | 30 |
I need to find if the last three consecutive months have increased in value.
How can I get SQL to chec...
As per the title, I'm trying to parse an XML file containing an xs:duration data type. I'd like to convert that into a Python timedelta object, which I can then use in further calculations.
Is there any built-in way of doing this, similar to the strptime() function? If not, what is the best way to achieve this?
...
I'm doing this in app/views/mymodel/add.ctp:
<?php echo $form->input('Mymodel.mydatefield'); ?>
And then, in app/controllers/mymodel_controller.php:
function add() {
# ... (if we have some submitted data)
$datestring = $this->data['Mymodel']['mydatefield']['year'] . '-' .
$this->data['Mymodel']['mydatefield'...
Hello,
I am trying to make a validation that will validate that the entered date is in future and that the selected date is in the next 7 days.
In order to validate if the date is in future I use;
valid_until.future?
and this one works fine, but to make a validation to check if the date selected is withing 7 days from now?
...
I have this: 2010-04-08T01:01:00Z
I want to remove the 'T' and everything behind it as well.
Also I would like to rewrite the date into this format: 08-04-2010
How can I do this the easiest way?
Thanks
...
How can I get SQLite to convert excel-type serial numbers to dates, e.g. I want the integer 40074 in a table to somehow get the date 18-Sept-2009?
The dates are already in SQLite.
...
Hi all,
I wish to create a view like
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>
but I get an error saying that DateTime must be a reference type in order to use for parameter TModel.
Fair enough, but I google plenty of examples that implement just what I try to achieve.
Any clues as to ...
import datetime
start = datetime.datetime(2009, 1, 31)
end = datetime.datetime(2009, 2, 1)
print end-start
>>1 day, 0:00:00//output
How to get the output in minutes
Thanks,
...
I have always had a problem with adding and subtracting time like for an
example:
10h:34min
+ 07h:46min
-----------
XX:XX
...
I have a class method that deals with dates:
public function setAvailability(DateTime $start, DateTime $end){
}
Since item availability can have lower limit, upper limit, both or none, I'd like to make setAvailability() accept NULL values as well. However, the NULL constant violates the type hinting:
$foo->setAvailability(NULL, $end)...
Hi,
I'm currently migrating some of my code from Cocoa (Apple's Objective-C API) to C, in order to make it available for other operating systems, such as GNU/Linux.
In Cocoa, there were many great things like creating NSTimeZone objects from their string descriptors using timeZoneWithAbbreviation:. This allowed me to use values like "E...
I have to create an "Expires" value 5 minutes in the future, but I have to supply it in UNIX Timestamp format. I have this so far, but it seems like a hack.
def expires():
'''return a UNIX style timestamp representing 5 minutes from now'''
epoch = datetime.datetime(1970, 1, 1)
seconds_in_a_day = 60 * 60 * 24
five_minute...
I have a query that takes too long to respond when the search parameter happens to be a varchar datatype with date. However, if i convert varchar to datetime variable, the query runs fine. For ex:
This takes too long.
select count(id)
from names
where updateddate > '1/5/2010'
This runs fine.
declare @dateparam datetime
set @...
What C function should I call to obtain a formatted date and time for the locale where the program is being executed?
I'm asking this question because I have run into a problem using the ClamAV daemon API. The VERSION command returns the date and time of the latest virus definitions, but the code uses a call to ctime to format it. As fa...
I tried this
SELECT convert(datetime, '23/07/2009', 111)
but got this error
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
However
SELECT convert(datetime, '07/23/2009', 111)
is OK though
How to fix the 1st one ?
...
In python how to sum up the following time
0:00:00
0:00:15
9:30:56
Thanks..
...