date

How to create a series of dates in Cocoa for a week

I am current writing an application and need to show the current days of the week. So, for the coming week I need to generate the follow dates. Monday, 5 January 2009 Tuesday, 6 January 2009 Wednesday, 7 January 2009 Thursday, 8 January 2009 Friday, 9 January 2009 I have already coded the application to generate five dates from the cu...

How can I parse dates and convert time zones in Perl?

I've used the localtime function in Perl to get the current date and time but need to parse in existing dates. I have a GMT date in the following format: "20090103 12:00" I'd like to parse it into a date object I can work with and then convert the GMT time/date into my current time zone which is currently Eastern Standard Time. So I'd li...

Date and time conversions xslt

Hi Folks, My problem is that I receive for example a date in a concatenated format: Ex: 20050728 And I have to retrieve it in a readable format through my xslt. Ex. 28 July 2005 I also have a similar question regards time. Ex: 0004 To be displayed as 00:04 How is this done? Thanks for the help! ...

How to Convert date into MM/DD/YY format in C#

In My Asp.net webpage I need to display today's date into one of the textbox , so in my form load I wrote the following code textbox1.text = System.DateTime.Today.ToShortDateString(); this line is giving me date like 1/7/09 but I want date like 01/07/09 , Is there anyway I can conver this date into mm/dd/yy format in C#? ...

date insertion algorithm

i have a List, it has Foo objects, and each Foo has a start date, and an end date. I want to insert a new Foo object, which has its own start and end date. I want the elements in the list to update their start and end dates accordingly, when the new Foo object is inserted, and for the new Foo object to find its correct place in the List....

Strange Date Problem with WebService ASP.Net SQL

My Server is located in US and I am running a query against it. The Data contained in the table both at Remote Server(U.S) and Local are same. The Problem is when I am retrieving the DataSet using WebService from Remote Server. The Dates Column is showing The Previous Date. For e.g Date Column is having "14 Jan 2007" but when retrieved ...

easy way to add 1 month to a time_t in C/C++

I have some code that uses the Oracle function add_months to increment a Date by X number of months. I now need to re-implement the same logic in a C / C++ function. For reasons I don't want/need to go into I can't simply issue a query to oracle to get the new date. Does anyone know of a simple and reliable way of adding X number of m...

Parsing datetime in Java

I have dates in the format 2008-12-23T00:00:00Z. This look a lot like a ISO 8601 format with a Zulu (UTC) timezone. I though the following code would parse it (using commons-lang) : String pattern = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(); Date d = DateUtils.parseDate(dateToParse, new String[] { pattern }); If I tak...

Grouping SQL results by continous time intervals (oracle sql)

Hi I have following data in the table: ID-----startDate----endDate 5549 2008-05-01 4712-12-31 5567 2008-04-17 2008-04-30 1 5567 2008-05-01 2008-07-31 1 5567 2008-09-01 4712-12-31 2 5569 2008-05-01 2008-08-31 5569 2008-09-01 4712-12-31 5589 2008-04-18 2008-04-30 5589 2008-05-01 4712-12-31 5667 2008-...

Showing the current date using JSTL formatDate tag

I am trying to show the current date in my JSP page using JSTL. below is the code I am using. <jsp:useBean id="now" class="java.util.Date" scope="request" /> <fmt:formatDate value="${now}" pattern="MM.dd.yyyy" /> But the above code is not producing any results? Am I missing anything here or is there any better approach for this? I am ...

How can I increment a date by one day in Java?

I am getting date in the format as yyyy-mm-dd. I need to increment this by one day. How can I do this? ...

What's the best way to manage dates across PHP, MySQL, etc?

My server is in Dallas. I'm in New York City.. and both PHP and MySQL have configuration variables for setting the timezone. How do I get them all to work together? What dates should I store in MySQL? How do I get PHP to handle changing the date based on the user's preference? Bear in mind: I don't think I'm ever having PHP explici...

[PHP]Calculate time difference between two dates, and present the answer like "2 days 3 hours ago"

Are there any classes/functions written in php publicly available that will take a timestamp, and return the time passed since then in number of days, months, years etc? Basically i want the same function that generates the time-since-posted presented together with each entry on this site (and on digg and loads of other sites). ...

Is there any trivial way to 'delete by date' using ´rm'- in bash?

I noticed today (after ~8 years of happily hacking away at bash) that there is no trivial way to 'delete by date' using ´rm'. The solution is therefore to pipe stuff around a combination of commands like rm, ls, find, awk and sed. Say for example I wanted to delete every file in the working directory from 2009, what would be a typical s...

How to select the most recent set of dated records from a mysql table

I am storing the response to various rpc calls in a mysql table with the following fields: Table: rpc_responses timestamp (date) method (varchar) id (varchar) response (mediumtext) PRIMARY KEY(timestamp,method,id) What is the best method of selecting the most recent responses for all existing combinations of metho...

How to set MySQL to use GMT in Windows and Linux

I'm just trying to get MySQL to store time in GMT... I've read the documentation here: http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html It says to set: default-time-zone='timezone' in an option file. However, I've googled for several different terms and cannot find possible values "timezone" is supposed to be. I also do...

How can I subtract a day from a python date?

I have a python datetime.datetime object. What is the best way to subtract one day? ...

Equivalent? No, but why?

T-SQL: 1(ANSI): convert(varchar(10),@DueDate, 102) < convert(varchar(10),getdate(), 102) 2(USA): convert(varchar(10),@DueDate, 101) < convert(varchar(10),getdate(), 101) Notice that these will return different results when year is considered. Why? What's the difference? Why isn't the operator taking year into consideration whe...

Parsing Ambiguous Dates (Language Independent)

I am curious what would be the best way to handle an ambiguous date string in any given language. When pre-validating your user input isn't an option, how should MM/dd/YYYY dates be parsed? How would you parse the following ambiguous date and for what reason (statistical, cultural, etc)? '1111900' as Jan 11, 1900 [M/dd/YYYY] or Nov 1,...

Calculating difference in dates in Java

Hi, I find it funny that Java (or the java.util library) does not have a built-in function to calculate difference in dates. What is the best way to do this? I know the simple way is to take the difference of the time in milliseconds and then convert that into days. However, i wanted to know if this works in all cases (with daylight sav...