I'm trying to extend Python's datetime.datetime class with a couple of extra methods. So, for example I'm doing:
import datetime
class DateTime(datetime.datetime):
def millisecond(self):
return self.microsecond/1000
but then if I do
>>> d = DateTime(2010, 07, 11, microsecond=3000)
>>> print d.millisecond()
3
>>> delta = ...
I'm working on a Rails app wherein I want to be able to search for records created in a given year using the Searchlogic gem, but I can't figure out how to have Searchlogic only search by year. I tried this in my search form:
<%= f.date_select(:created_at_equals, :start_year => 2010, :end_year => 2015, :discard_day => true, :discard_mo...
In a side project I have to manage, compare and display dates from different formats. What's the best design strategy to follow?
I planned:
All dates are parsed according their
format and stored in the db in
9-tuple python format using UTC
When I have to do calculations and
compares I transform 9-tuple in
datetime object (usin...
While struggling with DateTime.ParseExact formatting issues, I decided to feed ParseExact the out put from DateTime.ToString(), like this:
DateTime date2 = new DateTime(1962, 1, 27);
string[] expectedFormats = { "G", "g", "f", "F", "D", "d", "M/d/yyy", "MM/dd/yyy", "MM-dd-yyy", "MMM dd, yyy", "MMM dd yyy", "MMMM dd, yyy", "MMMM dd yyy" ...
I have a DataTable according to the Client Requirement it can contain invalid date
say "00/00/1999",NULL,Empty String.(Typed DatSet)
When i collect them as enumerables i wish to convert any of those invalid forms to empty string.
(i.e)
EnumerableRowCollection<DataRow> query =
from order in _table.AsEnumerable()
select
n...
I have a DateTime stored in universal time (UTC) of value 2010-01-01 01:01:01.
I would like to display it in EST in this format 2010-01-01 04:01:01GMT-04:00, however the 'K' formatter for timezone doesn't work in ToString
...
How do I convert a DateTime from EST/EDT to GMT but I don't know where the code will be ran (unknown local time zone) and also account for time savings...
...
I am trying to find a way to get the date of the matching day from last year,
so for example today is the 4th Friday in July, what would the date of the same be last year?
I am getting the sales from a restaurant and I need to check them against last years sales on the same day.
...
how can i get a list of DateTime objects which match the following criteria:
they are between two instances of DateTime
they fall on a fraction of an hour/min. eg. they are a full quarter of an hour
with active support a possible solution is:
(my_datetime_ob_a.to_i .. my_datetime_ob_b.to_i).each { |timestamp|
puts timestamp if (t...
I have a python datetime object which I would like to convert to UTC. I am planning to output it in RFC 2822 format to put in an HTTP header, but I am not sure if that matters for this question. I found some information on this site about converting time objects, and it looks simpler that way, but this time I really want to use datetime ...
Hi
I am trying to get the the result of in time and out time from dates
but it returns only hours using following select Query as follows
SELECT DATEDIFF(Hh,InTime,OutTime) as Diff_time from EmpLogTable
and i need result in HH:MM
Suppose my in time is 11 am and out is 5.49pm so o/p would be 6.49 but
using above select query i ...
Hi!
I have a table with 2 'datetime' fields: 'eventDate' and 'eventHour'. I'm trying to order by 'eventDate' and then by 'eventHour'.
For each date I will have a list os events, so that's why I will to order by date and then by time.
thanks!!
...
I am using RangeValidator to validate date enter in textbox and its working fine with default date format but now i want the date format in "dd/MM/yyy" but its generating excption with this date format. please provide me solution
my code:
in aspx page:
<asp:TextBox ID="txtrequiredby" runat="server" ></asp:TextBox >
<cc1:CalendarExtende...
Hi!
My Application uses For...Next loops to read a spreadsheet into a DataSet and then display information from it based on the results of search conditions (search term and a date range).
I'm having a problem with the data where, if I run a search that should return the first 400 rows in the spreadsheet, I'm only getting around 200 re...
I've inherited a codebase littered with DateTime objects created like this:
DateTime d = Convert.ToDateTime("2008-02-05");
which are failing when tests are ran on NY servers due to the culture of the string. I wish to convert them to the more sensible format:
DateTime d = new DateTime(2008,02,05);
I've written a VS macro that conve...
hi,
i want to insert data from an excel file into a local database in a UNIX server with java without any manipulation of data.
1- someone told me that i've to convert the excel file extension into .csv to conform with unix. i created a CSV file for each sheet (i've 12) with a macro. the problem is it changed the date format from DD-...
I'm working on a web app that will allow the user to do a lookup by date, so that, for example:
results = Something.objects.filter(end = date)
I'm planning on passing in the date information via the URL, like this:
example.com/invoicer?2/9/1984
I'll then grab the date via request.GET, break off the first part and store it as the m...
I'm tyring to use this snippet as my event calendar. Unfortunately it constantly raises new errors. Currently I get:
TemplateSyntaxError at /event/while-rendering-nothing-repeat/
Caught an exception while rendering: 'NoneType' object has no attribute 'date'
I'm pretty sure it comes from the line :
if day >= event.date.date() and day...
I have the following code, which is supposed to try to parse a given date. If it fails, it defaults to the current date:
var date = new Date(textbox.value); // Try to parse
if (isNaN(date)) date = new Date(); // Default to current
Now i'm using isNaN() to test if it was able to parse correctly, eg to check that new Date() didn't retu...
I am using an xsd having two <xs:list/> elements.
<xs:element name="packorder1" type="DateTimeTypeXsList"/>
<xs:element name="packorder2" type="DateTypeXsList"/>
<xs:simpleType name="DateTimeTypeXsList">
<xs:list itemType="xs:dateTime"/>
</xs:simpleType>
<xs:simpleType name="DateTypeXsList">
<xs:list itemType="xs:date"/>
</xs:si...