dates

Any C# SmartDate converters out there, e.g. "sun 11" --> 2009-12-06 11:00:00

In the spirit of not reinventing the wheel, can anyone point me to free C# code that does the following kinds of conversions? "sun" --> 2009-12-06 00:00:00 "tom" --> 2009-12-06 00:00:00 "tomorrow" --> 2009-12-06 00:00:00 "mon 8pm" --> 2009-12-07 20:00:00 "jan 5 at 10" --> 2010-01-05 10:00:00 and durations that return two datetimes l...

MySQL - convert and compare dates on query

I'm working on a football site witch, along with many features, list result tables. The tables are separated between seasons (season name, etc) and rounds (witch are generated everytime a new season starts up, like 2008/2009, 2009/2010, etc) rounds table has a start date and a end date, and the only way I have to dinamically know wich r...

How to delete records base on a date and offset

I need to delete records in a table if the current date is greater than the record creation date + a preset number of days (defined by @numberOfDays). I am using the following SQL statement but am not sure if it’s very efficient. Is there a better way? I am using MS SQL 2008 server. DELETE FROM deviceManager.Test2 WHERE DATEADD(day, @n...

How to get difference between two days in iPhone

Hi All, I would like to calculate the no of days,hours,minutes between two different dates in iPhone(Objective C). Please provide any code sample to do the same. Thanks Sandeep ...

SQL BETWEEN 2 date values HELP

SELECT * FROM myDateTable WHERE date_Start OR date_end BETWEEN DateValue('" & CoverMonth_start & "') AND DateValue('" & CoverMonth_end & "')" TheCoverMonth start and end dates are looping from January to December. This query is suppost to select only the records WHERE date_Start OR date_end BETWEEN DateValue... B...

Human-readable date formats

You may have noticed that certain web applications (for example, certain parts of GMail) display dates in a more human-readable format than simply DD/MM/YYYY. For example, if I open up a mail item from the 23rd (which happens to be 3 days ago at the time of writing, I'll get the following: Dec 23 (3 days ago) I'd like to implement...

SQL date,period comparison

Hi I'm having some problem with logic of the comparison of some periods. I have a table in my database that looks like this: Id|startDate |amount of weeks| -------------------------------- A1|2010-01-04 | 3 B3|2010-01-11 | 2 all the startDates start on the same day of the week (Monday) now I need to write an sql where I have 2 para...

Access Date Format problem on new server ie MM/DD/YY instead of DD/MM/YYYY

I seem to have ran into a problem I thought I had long ago solved My web host recently changed one of the servers some of my sites are on, and this has caused problems with one site in particular that uses an access database When inserting dates it seems to now take a date in the format DD/MM/YYYY and record it in the database as MM/DD...

Classic ASP: Calculate the number of weeks by date

I am trying to fix a function which returns the number of weeks in a given year. Here's how it looks: Function GetWeekNo(date) weekOfYear = DatePart("ww", DateValue(date), vbMonday, vbFirstFourDays) If weekOfYear > 52 Then If DatePart("ww", DateValue(date) + 7, vbMonday, vbFirstFourDays) = 2 Then weekOfYear =...

[javascript] Datestring formatting

Hi, I've been working a lot with dates and various capacities for the past month. I can't seem to find any decent documentation on working with dates in javascript. for example: PHPfreaks has a wonderful explanation of any and all date() functions. I just want to make sure I am properly utilizing all of the date object's methods. W3...

repeated dates in rows

Hello, I have grid view.It contain date columns. I dont want to show repeat date in all the rows. I mean i have to show on top once. Please see my grid below. On Date Added column i want to show date only once if it is same date added. Date Added Who Added Updated Who Updated Action Code Comment Edit 02/05/01 UTA 02/05/01 UTA 008 ...

MySQL Query - Records between Today and Last 30 Days

Greetings! I want to return all records that were added to the database within the last 30 days. I need to convert the date to mm/dd/yy because of display purposes. create_date between DATE_FORMAT(curdate(),'%m/%d/%Y') AND (DATE_FORMAT(curdate() - interval 30 day,'%m/%d/%Y')) My statement fails to limit the records to the last 30...

Epoch Time (Ticks since 1970) - Mac vs. Windows

I have some C# web services that return JSON. The .NET JavaScriptSerializer returns dates in Epoch Time (milliseconds since 1970). On any Windows machine, the web based application processes the milliseconds back into the proper date without a problem. On my Mac, the dates are sometimes off by 1 hour. Not every time. Only sometimes....

Getting day suffix when using DateTime.ToString()

Is it possible to include the day suffix when formatting a date using DateTime.ToString()? For example I would like to print the date in the following format - Monday 27th July 2009. However the closest example I can find using DateTime.ToString() is Monday 27 July 2009. Can I do this with DateTime.ToString() or am I going to have to f...

Modify regex to match dates with ordinals "st", "nd", "rd", "th"

How can the regex below be modified to match dates with ordinals on the day part? This regex matches "Jan 1, 2003 | February 29, 2004 | November 02, 3202" but I need it to match also: "Jan 1st, 2003 | February 29th, 2004 | November 02nd, 3202 | March 3rd, 2010" ^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\ 31...

How to create database records for a financial year

Hello, I need to create entities (specifically contracts) in a database table that are associated with a financial year. These contracts will be applied to projects. Any contract variation will be recorded by creating a new contract record for the same financial year but the original will remain associated with the project as a history....

Add working hours to timestamp

Hi, I need to add working hours to a timestamp. Working hours are from 8am to 6pm. Lets say we have 2pm and I have to add 6 hours. Result should be 10am... any guesses? Thanks. ...

mysql - search between dates where all dates appear

I'm working with some imported data that stores details about whether a "room" is available on a specific day or not. Each room has an individual entry for the date that it is available. | id | date | price | -------------------------------- | 1 | 2010-08-04 | 45.00 | A user can search across a date range and the sea...

What is the Best Practice for manipulating and storing dates in Java?

What is the Best Practice for manipulating and storing Dates e.g. using GregorianCalendar in an enterprise java application? Looking for feedback and I will consolidate any great answers into a Best Practice that others can use. Thanks! ...

how to turn a month (8/8/2009) into "8 August" with asp.net mvc

How do you turn a field from the database, say, (8/8/2009) into 8 August? ...