dates

MySQL query to delete rows whose dates are close to another row

I've got a table containing many rows. The rows are guaranteed to have been inserted in order of a column called created_on, which is a datetime column. If a given row has a created_on time within 5 seconds of an existing row, I'd like to delete the given row. How would I write a query to delete those rows? ...

expression engine: start_on

I am using the following within the exp:weblog:entries tag: start_on="{current_time format='%Y-%m-%d %H:%i'}" I want to use this so that when the date of an event is past the current date then the event will disappear from the page. The problem is that I have some events that only have an entry date (ex. April 04, 2009) and others tha...

SQL that list all birthdays within the next and previous 14 days

I have a MySQL member table, with a DOB field which stores all members' dates of birth in DATE format (Notice: it has the "Year" part) I'm trying to find the correct SQL to: List all birthdays within the next 14 days and another query to: List all birthdays within the previous 14 days Directly comparing the current date by: (D...

Java Timestamp - How can I create a Timestamp with the date 23/09/2007?

How can I create a Timestamp with the date 23/09/2007? ...

Generate a periodic value based on dates

I was hoping someone that is good with math and loops could help me out. I'm writing a program in Objective C where I need to come up with a way to do a cycle. If you don't know Objective C I would appreciate any help in pseudo code just to help me figure this out. What I need is a scale that is based on two dates. I know this will be s...

Date difference in English

Near duplicates How do I calculate relative time? How do I calculate someone’s age in C#? Anyone know how of a function in VB.NET or C# that will take two dates, calculate the difference and output that difference in an english string? For example if I pass the dates '3/10/2009' and '3/25/2009', the function would return the s...

Creating a range of dates in Python

Hello, I want to create a list of dates, starting with today, and going back an arbitrary number of days, say, in my example 100 days. Is there a better way to do it than this? import datetime a = datetime.datetime.today() numdays = 100 dateList = [] for x in range (0, numdays): dateList.append(a - datetime.timedelta(days = x)) p...

How do I combine 3 SQL queries into 1?

This is written to count how many people have visited within the last day. I want to also include how many have visited in the last week and year and have it output altogether without doing 3 separate queries. SELECT COUNT(updated_at) AS 'TODAY' FROM parts_development.page_views p WHERE updated_at >= DATE_SUB(NOW(),INTERVAL 1 day) GR...

Custom List Compare dates in Sharepoint

I am creating two columns Start and end date, when the user enters end date I should validate it with the start date to check that its greater than start date, is there a way to do that?? I am using Custom Library for this, My requirement is I have to store a document with start and end date and I need to do some validations on it. Than...

Recurring dates on dates that do not exist

When giving the option for something to reoccur every certain amount of time how should I treat times that don't reoccur on every interval? For example what should happen to birthday reminders for February 29th? Or if I have a monthly appointment on the 31st what should happen on months that do not have a 31st day? What do you believe ...

calendar methods

apart from the inbuilt functions, can we use any simple formulas to calculate the start day of the month given month and year as inputs?? ...

Why is NSCalendarDate in the Simulator SDK but not in the iPhone SDK?

I want to use NSCalendarDate, which exists in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/ System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSCalendarDate.h but is not present anywhere under /Developer/Platforms/iPhoneOS.platform What gives? ...

Formatting a date in javascript

I noticed that javascript new Date() function is very smart in accepting dates in several formats. Xmas95 = new Date("25 Dec, 1995 23:15:00") Xmas95 = new Date("2009 06 12,12:52:39") Xmas95 = new Date("20 09 2006,12:52:39") But i could not find documentation anywhere showing what all string formats that are valid while calling new Date(...

PostgreSQL: Unknown Date Output Format. How Can You Convert Date Output Format?

I've been storing dates in a PostgreSQL 8.3 database table using a query resembling something like this: INSERT INTO files (date_uploaded) VALUES (now()); According to the documentation there are four formats that PostgreSQL 8.3 will output depending on the setup. My select statement is returning an unknown fifth format: 01:10:00.578...

Date manipulation in C++

I am sure that this kind of questions must have been asked before, but failed to find anything by searching this site. My apologies in advance if I missed any similar questions. Is there anything in C++ that just does date manipulation at all? I am aware of SYSTEMTIME structure (it is the structure returned when you do GetSystemTime I ...

Repeating "Events" (Calendar)

I'm currently working on an application that allows people to schedule "Shows" for an online radio station. I want the ability for the user to setup a repeated event, say for example:- "Manic Monday" show - Every Monday From 9-11 "Mid Month Madness" - Every Second Thursday of the Month "This months new music" - 1st of every month. Wha...

What to consider before storing negative-dates in MySQL?

I'm working on a project now that will require me to enable users to store negative-dates in the database. These dates have the potential to span many thousands of years BC, and as late as 'Today.' I've worked on many projects that stored dates, but they were all relatively-recent dates, and none of them were ever negative (BC). What ty...

Advanced Date-Validation with PHP

I've got to validate numerous dates with my current project. Unfortunately, these dates can vary wildly. Examples include: 1983-07-10 (After 1970) 1492-10-11 (Before 1970, year of Unix Timestamps - this eliminates strtotime() on some systems) 200 B.C. (Really old...) Dates will not exceed 9999 b.c., nor will they be future (beyond 't...

Localizing Date Ranges

Does anyone know how to localize date ranges using C#? In particular, I want to generate "smart" date ranges, so that redundant information is eliminated. Here are some examples in US English August - Sept, 2009 August 2009 August 1 - 9, 2009 January 1 - March 3, 2009 December 6, 2009 - January 8, 2010 Form what I can tell the .NE...

What is the precise definition of JDE's Julian Date format?

I am writing code to convert from a Gregorian date to a JDE (J.D.Edwards) Julian date. Note: a JDE Julian date is different from the normal usage of the term Julian date. As far as I can work out from Googling, the definition of a JDE Julian date is: 1000*(year-1900) + dayofyear where year is the 4-digit year (e.g. 2009), and dayofy...