datetime

How can I filter a date of a DateTimeField in Django?

I am trying to filter a DateTimeField comparing with a date. I mean: MyObject.objects.filter(datetime_attr=datetime.date(2009,8,22)) I get an empty queryset list as an answer because (I think) I am not considering time, but I want "any time". Is there an easy way in Django for doing this? * I have the time in the datetime...

How do you calculate an end time based on start time and duration?

I'm building a event calendar and pass a start time to PHP, in the format of 2009-09-25 15:00:00. A duration gets passed as well, that might be in the format of 60 minutes or 3 hours. Converting from hours to minutes isn't the problem. How do you add a length of time to an established starting point to correctly format the end time? ...

Datamapper DateTime to String behaviour

I write my first project wich using Datamapper as ORM, so please be patient. :) I try to do get String from DateTime field: Error.first.submitted_at.to_s => "2009-08-24T12:13:32+02:00" Returned String is not good for me. In ActiveRecord I can do something like that: Error.first.submitted_at.to_s(:only_date) or any other da...

find how many sunday from 2 given dates?

from 01-01-2009 to 02-23-2009 how to find out how many Sunday in between these days?? ...

Parsing DateTime strings

Hi, I'm having some difficulties parsing strings of DateTime using DateTime.ParseExact. DateTime result; CultureInfo provider = CultureInfo.InvariantCulture; // Parse date-only value with invariant culture. //format = "mm/dd/yyyy"; format = "d"; try { result = DateTime.ParseExact(data+" 12:00:00 AM", forma...

Date and Time helper for PHP (like jodatime in java)

Hi, I am looking for library (open source) like Joda Time in Java world. is there any library like that ? Joda Time is very helpful to calculate date and time. I can add days, weeks, month, year and also can converting date and time easily. I wish there is library like joda time for PHP edit: I need some functions that available in...

Need to parse a string, having a mask (something like this "%yr-%mh-%dy"), so i get the int values.

For example i have to find time in format mentioned in the title(but %-tags order can be different) in a string "The date is 2009-August-25." How can i make the program interprete the tags and what construction is better to use for storing them among with information about how to act with certain pieces of date string? ...

ognl.MethodFailedException "setCreatedDate" failed for object com.security.data.PasswordHistory@d5b561

i am using strut2.1.6 with tomcat 5.5 i have a Date field createDate in my PasswordHistory Bean, and corresponding date component on my "search.jsp" this field is optional - no validation required . if i submit the form i am get the follwoing error on console ognl.MethodFailedException: Method "setCreatedDate" failed for object com.s...

How can I parse a date including timezone with Joda Time

This snippet of code always parses the date into the current timezone, and not into the timezone in the string being parsed. final DateTimeFormatter df = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss 'GMT'Z yyyy"); final DateTime dateTime = df.parseDateTime("Mon Aug 24 12:36:46 GMT+1000 2009"); System.out.println("dateTime = " + d...

Time difference between two times in the same table

Hello! (Please note that I have seen a similar question on StackOverflow recently, however I can not find it anywhere - if anyone can find it please post the link) I have a table that has a datetime field in it. For example: Table data DateTime date; int number; I need to find the difference between date in a row and date in the ne...

Oracle Date field - Time issues

We have two databases, in two separate locations. One of the databases resides in a separate time zone than our users. The problem is that when the database that is located in a separate time zone is updated, with a Date value, the database automatically subtracts 1:00 hour from the Date it was passed. The issue is that, when passing ...

Date fields in MySQL, finding all rows that don't overlap and returning only the difference

So this was one of my very first questions here, but I have a slight variation: So I have two people whose schedules are in a database. The schedules simply record the start time, end time, and description of the various events/appointments for both users. PersonA wants to trade appointments with PersonB. I want a MySQL query that will...

T-SQL: How to update just date part of datetime field?

In SQL Server 2008 I need to update just the date part of a datetime field. In my stored procedure I receive the new date in datetime format. From this parameter I have to extract the date (not interested in time) and update the existing values date part. How can I do this? ...

Why isn't telligent's RSS.Net fork parsing dates?

I'm using Telligent's RSS.Net fork to parse an XML Stream. The stream is well-formed and most of the desired elements are being parsed, but for some reason the pubData element isn't. Inspecting the feed contents shows the pubData element nicely displayed, no issues with the RSS or the element contents. But... As I said, no parsing, ei...

jQuery DateTime picker and ASP.NET MVC

I'm currently using a jQuery Date Time picker to select a date time to be put in to a database. When using the date time picker, the result shows up properly in the text box it is bound to (IE 27/09/2009 16:00). However, the date time is not being passed to the MVC application properly, and is being received as 01/01/0001 00:00:01. The...

Just Date or Time

I'm just wondering .. I have and object like this public class Entry{ public DateTime? Date { get; set;} // This is just Date public DateTime? StartTime { get; set; } //This is just Time public TimeSpan Duration { get; set; } //Time spent on entry } Is there a more appropriate type than DateTime or better strategy to handling j...

How to convert a mysql datetime in PHP to m/d/y format?

I am trying to convert a mysql DATETIME into this format m/d/y but the code below is not working, returns 12/31/1969 instead can someone show me how to do this? $fromMYSQL = '2007-10-17 21:46:59'; //this is the result from mysql DATETIME field echo date("m/d/Y", $fromMYSQL); ...

How do I find the time difference between two datetime objects in python?

How do I tell the time difference in minutes between two datetime objects? ...

How to handle null for a allow-null datetime field (DB) in our program?

How could we handle null for a datetime field (got from SQL Server) in our program in c#? ...

Does the formatting of a date depend on both the user's locale and calendar system?

I feel this question is very general for all programmers on all languages. This is somewhat blurry. First, there are locales, which encapsulate cultural information and other stuff. I believe these locale objects also encapsulate information about date and time formatting, i.e. how to display a date, in Unicode Standard. Like so, for exa...