dates

How to get all dates of sundays in a particular year in Java

am seriously looking for this code...am now to programing actually i want to make all dates with flag,which all are sunday in a particulr year.plz am eagarly waiting for ur response.... ...

Get the previous month's first and last day dates in c#

I can't think of an easy one or two liner that would get the previous months first day and last day. I am LINQ-ifying a survey web app, and they squeezed a new requirement in. The survey must include all of the service requests for the previous month. So if it is April 15th, I need all of Marches request ids. var RequestIds = (from r...

Best practice for ignoring year in date for date ranges

I need to model some information about seasons, and need to track them based on start / end date in a year-agnostic way. I.e. I need to allow users to define summer as being between, say, May 15th and September 10th, and do that for all years. I'll need to do a lot of checking of the type isThisDateInSeason). All the date manipulati...

Formatting the Date in JavaScript

Using newDate() function in Java script, I am able to get today's date. I am getting the date in the format 3/3/2009 (d/m/yyyy). But i actually need the date in the format 2009-03-03 (yyyy-mm-dd). Can anyone pls let me know how to format the date as i require? ...

Business Weeks

I need a function in php that will calculate the business week in a specific format within a given date range. Example: startDate = 02-03-2009 endDate = 31-12-2010 Mar 2-6 Mar 9-13 Mar 16-20 Mar 23-27 Mar 30 - Apr 3 Apr 6 - 10 and so on... ...

What is the first leap year after 1 AD to start on a monday?

I'm asking because it makes some things really nice for some math I'm doing. I'll post it when I find it if no one gets to it first ...

Modify master.dbo.syslanguages or insert new language

In my application we have to call SET DATEFORMAT YMD before each and every operation. In the master.dbo.syslanguages in entry for my language (polish, lcid=1045) there is dmy format. So is there any way I could change this entry or create a new language that will be like old one, but with changed DATEFORMAT? ...

django : using admin datepicker

I'm trying to use the admin datepicker in my own django forms. Roughly following the discussion here : http://www.mail-archive.com/[email protected]/msg72138.html I've a) In my forms.py included the line from django.contrib.admin import widgets b) and used the widget like this : date = forms.DateTimeField(widget=widget...

Date range from weeknumber + year

Hi Guys, I have 2 dropdowns 1 with weeknumbers 1 with years. I want to extract the date range from this data. So: Weeknumber 13 year 2009 would give: monday 23 march 2009 tuesday 24 march 2009 ... VB.Net preferred but C# sollution is also ok. Edit: Ok I guess I should have mentioned this is for European dates. ...

How to determine the date one day prior to a given date in Java?

I am assuming Java has some built-in way to do this. Given a date, how can I determine the date one day prior to that date? For example, suppose I am given 3/1/2009. The previous date is 2/28/2009. If I had been given 3/1/2008, the previous date would have been 2/29/2008. ...

How to offset dates in a MySQL database by 1 second?

I've imported a bunch of posts into a Wordpress site that all have the exact same date. I'd like to edit the post dates so they are offset by one second. My concern is that there may be a performance issue when all of the dates are the same. Anyone know quick way to get this done using phpMyAdmin to edit the MySQL database or some other ...

Comparing two date ranges when one range has a range of starting dates.

I've got the next problem up from this one: http://stackoverflow.com/questions/143552/comparing-date-ranges The solution to comparing two ranges is the query: SELECT * FROM periods WHERE NOT (range_start > @check_period_end OR range_end < @check_period_start) I have the added problem. I am allowing people to enter a ran...

Finding free slots in a booking system

In my question about searching for date ranges I tried simplifying the problem and inadvertently posed a different and simpler problem. Rather than complicate that question with an edit I am going to ask the problem I actually intended. I have two tables Property and Booking. Bookings have a foreign key to Properties and also start an...

How to store approximate dates in MySQL?

I need to store dates such as 'Summer 1878' or 'Early June 1923', or even 'Mid-afternoon on a Tuesday in August'. How would you suggest I do this? I have considered breaking the date and time up into separate (integer) columns, and giving each column an ancillary (integer) column containing a range (0 if exact; NULL if unknown). But I...

Import Date Format mmddyyyy

Hello, I have to import dates into oracle with this type of format 03JUN2008 The only example I've seen this done before has dashes and this does not. Should I just bring it in as varchar and manipulate or is there another way? Thanks ...

my NSDateFormatter works only in the iPhone simulator

I use a NSDateFormatter which works fine in the simulator, but I get a nil when I run it in the iPhone. I hardcoded the date to be sure of the format, but it fails anyway. NSString *strPubDate = @"Fri, 8 May 2009 08:08:35 GMT"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setFormatterBehavior:NSDateFo...

Efficent way to set date using week of month value

I have a week of month in sql and i need to generate a datetime varible from that.. fields i have are dayofweek, weekofmonth and month values. anyone know of a quick effective way to calculate this in mssql 2005? Thanks Keep in mind. if week of month is set to 5 it is the last week of the month Examples are i have DayOfWeek, month, yea...

How can I perform divison on a datetime.timedelta in python?

I'd like to be able to do the following: num_intervals = (cur_date - previous_date) / interval_length or print (datetime.now() - (datetime.now() - timedelta(days=5))) / timedelta(hours=12) # won't run, would like it to print '10' but the division operation is unsupported on timedeltas. Is there a way that I can implement div...

Given a date range how to calculate the number of weekends partially or wholly within that range?

Given a date range how to calculate the number of weekends partially or wholly within that range? (A few definitions as requested: take 'weekend' to mean Saturday and Sunday. The date range is inclusive i.e. the end date is part of the range 'wholly or partially' means that any part of the weekend falling within the date range means the...

how to find out whether or not a date is 1 year before today's date in java

In java, how can I find out if a specific date is within 1 year of today's date. I have the following but not sure if this is the best approach. String date = "01/19/2005"; DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date lastExamTakenDate = null; Calendar todaysDateMinus1Year = Calendar.getInstance(); t...