Ge the most recent date from a list - Ruby
I have an array of Ruby Date objects. How can I find the most recent datetime and the oldest datetime? thanks ...
I have an array of Ruby Date objects. How can I find the most recent datetime and the oldest datetime? thanks ...
How can I get the next friday with the Joda-Time API. The LocalDate of today is today. It looks to me you have to decide whever you are before or after the friday of the current week. See this method: private LocalDate calcNextFriday(LocalDate d) { LocalDate friday = d.dayOfWeek().setCopy(5); if (d.isBefore(friday)) { return d.dayO...
In my users setting I have a dropdown with all the GMT dates for the user to select. In c#, how would I convert a datetime stored in the database to their GMT time? The time stored in the database is the servers time. ...
I'm trying to find a MySQL query which will obtain the time that is the next half-past-the-hour from a specified datetime. I explicitly mean the next half-past-the-hour, not the next half-hourly point. So for instance: If the datetime was "2009-10-27 08:15:24", the answer would be "2009-10-27 08:30:00" If the datetime was "2009-10-27 ...
We have a custom control that has a "Value" property of type System.Nullable (aka System.DateTime?). We have an object with a "Received" property of the same type. When we try to bind the control to the object, the following InvalidCastException is thrown: Invalid cast from 'System.DateTime' to 'System.Nullable`1[[System.DateTime, msc...
I am trying to determine the duration of elapsed time minus any interruptions. The method below seems inefficient and silly is there a better method? The user specifies an end_time and a start_time are and records any interruptions as an integer representing minutes. def duration ((end_time - start_time).seconds - interrupt.minutes) ...
I have a file in below format. DATE Time, v1,v2,v3 05:33:25,n1,n2,n3 05:34:25,n4,n5,n5 05:35:24,n6,n7,n8 and so on upto 05:42:25. I want calculate the values v1, v2 and v3 for every 5 min interval. I have written the below sample code. while (<STDIN>) { my ($dateTime, $v1, $v2, $v3) = split /,/, $_; my ($date, $time) = split ...
Hi, I have model class info(db.Model): user = db.UserProperty() last_update_date = db.DateTimeProperty() I need to retrieve last_update_date for specific user. It is working good, i can retrieve this value, i can even pass it to another variable if results: for result in results: data = result.last_up...
I didn't realize this, but apparently Python's strftime function doesn't support dates before 1900: >>> from datetime import datetime >>> d = datetime(1899, 1, 1) >>> d.strftime('%Y-%m-%d') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: year=1899 is before 1900; the datetime strftime() methods requi...
I'm using the America/New York timezone. In the Fall we "fall back" an hour -- effectively "gaining" one hour at 2am. At the transition point the following happens: it's 01:59:00 -04:00 then 1 minute later it becomes: 01:00:00 -05:00 So if you simply say "1:30am" it's ambiguous as to whether or not you're referring to the first tim...
Ever since British Summer Time ended in the UK last week my application has been seeing a very interesting bug. Here's an isolated Perl script which demonstrates the issue: #!/usr/bin/perl use strict; use warnings; use DateTime::Format::W3CDTF; use DateTime::Format::ISO8601; my $tz = 'Europe/London'; sub print_formatted_date { my ...
I have a problem with Jquery function getJSON, the action url does not trigger because one of the parameter i am passing is a javascript date but the action expects c# DateTime.. Is it possible to format the Javascript Date to make it compatible for c# DateTime? ...
I don't know how to show Time in AM/PM format in blackberry using blackberry datefield.Pls give me a idea how to do this. ...
Hello, I have a SQL Server 2005 database table, which has a datetime column. I write an entry in this table every time a service processes an incoming request. What I would like to get is a breakdown of the time spans between sequential entries. If the data is: 2009-10-30 04:06:57.117 2009-10-30 03:52:44.383 2009-10-30 03:42:00.990 2...
Hello all. Heres my situation: import foo, bar, etc frequency = ["hours","days","weeks"] class geoProcessClass(): def __init__(self,geoTaskHandler,startDate,frequency,frequencyMultiple=1,*args): self.interval = self.__determineTimeDelta(frequency,frequencyMultiple) def __determineTimeDelta(self,frequency,frequencyMu...
Does C++ stl have a standard time class? Or do I have to convert to c-string before writing to a stream. Example, I want to output the current date/time to a string stream: time_t tm(); ostringstream sout; sout << tm << ends; In this case I get the current date/time written out as a number without any formatting. I can use c- runtime...
I expect it to be Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern if not specified explicitly in CalendarExtender.Format property but it's not. I don't set the property in my .aspx markup but in the debugger it reports "d". Well, DateTime.Now.ToString("d") returns "31.10.2009" (which corresponds to CurrentUICulture)...
I have to build a DropDownList with the dates of the last 7 days. I would like the DropDownList displays the date as "DD/MM/YYYY". So I created a list of dates: DateTime date = DateTime.Now; List<DateTime> dates = new List<DateTime>(); for (int i = 0; i < HISTORY_LENGTH; i++) { dates.Add(date.AddDays(-i)); } DropDownList.DataSourc...
Why is DateTime a structure instead of an inheritable class? (I would like to be able to override the ToString() method but I can't.) ...
I have a table called tblRentalRates with the following columns: rate_id (int) rate_startdate (datetime) rate_enddate (datetime) weekday_rate (money) weekend_rate (money) I want to accomplish the following goal: Write a query that will check the contents of the table and ensure that for the current year, that the data covers ...