I need to determine the current year in Java as an integer. I would like to be able to use this value as a counter that I can, for example, use to run from now until a specified year in the past (i.e. my value starts at 2008, and I have a "firstYearOfData" value that is set to 1994. I can now run my process from 2008 back to 1994). I cou...
Given two datetimes. What is the best way to calculate the number of working hours between them. Considering the working hours are Mon 8 - 5.30, and Tue-Fri 8.30 - 5.30, and that potentially any day could be a public holiday.
This is my effort, seem hideously inefficient but in terms of the number of iterations and that the IsWorkingDay...
In mysql, If I have a list of date ranges (range-start and range-end). e.g.
10/06/1983 to 14/06/1983
15/07/1983 to 16/07/1983
18/07/1983 to 18/07/1983
And I want to check if another date range contains ANY of the ranges already in the list, how would I do that?
e.g.
06/06/1983 to 18/06/1983 = IN LIST
10/06/1983 to 11/06/1983 = IN ...
I basically want to do this:
grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log
...with of course the filename being example.com.2008-09-27-11:21:30.log
I'd then put this in crontab to run daily.
...
Suppose I have a date, i.e. year, month and day, as integers. What's a good (correct), concise and fairly readable algorithm for computing the ISO 8601 week number of the week the given date falls into? I have come across some truly horrendous code that makes me think surely there must be a better way.
I'm looking to do this in Java but...
If I have two dates (ex. '8/18/2008' and '9/26/2008') what is the best way to get the difference measured in days?
...
I need to parse a string like "February 12, 1981" as a Date. I use SimpleDateFormat. But if I do:
new SimpleDateFormat("MMMMM dd, yyyy").parse("February 12, 1981")
I get java.text.ParseException.
I tried to reduce it to see where the problem is. First:
new SimpleDateFormat("MMMMM").parse("February")
works. Then:
new SimpleDateFor...
I've got a little problem, I need to be able to have a reoccurring event (forever) that marks the day after the second Tuesday of each month.
Your probably thinking, why not just Wednesday of each month.
October 2008 is an example, it starts on a Wednesday. :(
Really I just need it in Outlook, probably (but not limited to) some iCalend...
I am using an asp:Calander and I have an object that has a beginning date and an ending date. I need to get all the dates between these two dates and place them in an array so i can then render corresponding dates on the calander with different CSS
...
Does SubSonic.SqlQuery have a between/and for date ranges? If not, what would be the best way to get a range.
...
I want to display dates in the format: short day of week, short month, day of month without leading zero but including "th", "st", "nd", or "rd" suffix.
For example, the day this question was asked would display "Thu Oct 2nd".
I'm using Ruby 1.8.7, and Time.strftime just doesn't seem to do this. I'd prefer a standard library if one ex...
What's the easiest way to compute the amount of working days since a date? VB.NET preferred, but C# is okay.
And by "working days", I mean all days excluding Saturday and Sunday. If the algorithm can also take into account a list of specific 'exclusion' dates that shouldn't count as working days, that would be gravy.
Thanks in advance...
How can I elegantly print the date in RFC822 format in Perl?
...
Is there some simple way to calculate a Weeknumber value from a date value stored in XML?
It needs to be pure XSLT solution. I cannot use any code :(
...
Specifically MSSQL 2005.
...
I'm using SimpleDateFormat with the pattern "EEE MM/dd hh:mma", passing in the date String "Thu 10/9 08:15PM" and it's throwing an Unparseable date exception. Why? I've used various patterns with SimpleDateFormat before so I'm fairly familiar with its usage. Maybe I'm missing something obvious from staring at it too long.
The other po...
I'd like to know if Flash/AS3 has any nice way to convert an AS3 'Date' object to/from rfc-850 timestamp format (as used by HTTP date and last-modified).
This question is very similar to this question about rfc 3339, except it's specific to AS3 and rfc-850.
RFC-850 is like: Thu, 09 Oct 2008 01:09:43 GMT
...
I've had nothing but good luck from SO, so why not try again?
I have an application that needs to show a different image based on the season of the year (spring, summer, winter, fall). I have very specific start and end dates for these seasons.
What I would like from you geniuses is a method called GetSeason that takes a date as inpu...
I am currently working on a website to track projects. In it, it is possible to create Service Level Agreements (SLAs). These are configurable with days of the week that a project can be worked on and also the timespan on each of those days. Eg. on Monday it might be between 08:00 and 16:00 and then on friday from 10:00 to 14:00. They ar...
I'm looking for some succinct C# 3 code to generate a random date between Jan 1 1995 and the current date.
I'm thinking some solution that utilizes Enumerable.Range somehow may make this more succinct.
...