date

SQL Date Formulas

I need a date formula in Oracle SQL or T-SQL that will return a date of the previous week (eg Last Monday's date). I have reports with parameters that are run each week usually with parameter dates mon-friday or sunday-saturday of the previous week. I'd like to not have to type in the dates when i run the reports each week. The data ...

What is the easiest or most effective way to convert month's abbreviation to a number in Perl? (ie "jan" to 1)

If I import a library to use a method, would it be worth it? Does importing take up a lot of memory? ...

What is the best way to parse a date in MM/DD/YY format and adjust it to the current / previous century?

One of our customers wants to be able to enter a date with only 2 digits for the year component. The date will be in the past, so we want it to work for the previous century if the 2 digit year is after the current year, but work for the current century if the 2 digit year is equal to or less than the current year. as of today 10/30/200...

The fifteenth of February isn't found

I'm in javascript, running this in the console d = new Date(); d.setMonth(1); d.setFullYear(2009); d.setDate(15); d.toString(); outputs this: "Sun Mar 15 2009 18:05:46 GMT-0400 (EDT)" Why would this be happening? It seems like a browser bug. ...

Oracle: how to add minutes to a timestamp?

I need to add 30 minutes to values in a Oracle date column. I do this in my SELECT statement by specifying "to_char(date_and_time + (.000694 * 31)", which works fine most of the time. But not when the time is on the AM/PM border. For example, adding 30 minutes to "12:30" [which is PM] returns "1:00" which is AM. The answer I expect i...

PHP Convert HTML Formatted Date

Published Date returned from Twitter Search API Atom Feed as 2008-11-03T21:30:06Z which needs to be converted to "X seconds/minutes/hours/days ago" for showing how long ago twitter messages were posted. Think this can be done with php date() function using DATE_ATOM value? ...

openbd cfloop over a date

I'm trying to convert my sites from CF8 to openBD. I have a cfloop in a site that loops over a date range. In essence, I want to insert a new record into the db for every 2 weeks (step) of a date range (from and to) my loop looks like this... <cfloop from = "#form.startDate#" to = "#form.endDate#" index = "i" step =...

Javascript: how to validate dates in format MM-DD-YYYY?

I saw a potential answer here but that was for YYYY-MM-DD: http://paulschreiber.com/blog/2007/03/02/javascript-date-validation/ I modified the code code above for MM-DD-YYYY like so but I still can't get it to work: String.prototype.isValidDate = function() { var IsoDateRe = new RegExp("^([0-9]{2})-([0-9]{2})-([0-9]{4})$"); ...

Increase days to php current Date()

How do I add a certain number of days to the current date in PHP? I already got the current date with: $today = date('y:m:d'); Just need to add x number of days to it ...

How can I change the format of a date from the command line?

What's the quickest way to convert a date in one format, say 2008-06-01 to a date in another format, say Sun 1st June 2008 The important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other things around - in a non-deterministic fashion. I'm running GNU bash, version 3.2.17(1)-release (i386...

Using varchar instead of date field types in MySQL

Is there any reason to use a varchar field instead of a date field in MySQL? I'm looking at an existing site and I see the developer has done this. Is there any reason to? ...

Java , adding minutes to a Date , weird anomaly

With Java Version 1.5.0_06 on both Windows and Ubuntu Linux : Whenever I add minutes to the date "2008/10/05 00:00:00" , it seems that an extra hour is wrongly added. ie: adding 360 minutes to 2008/10/05 00:00:00 at midnight should arrive at 2008/10/05 06:00:00 But it is arriving at 2008/10/05 07:00:00 The totally perplexing thing is...

The difference in months between dates in MySQL

I'm looking to calculate the number of months between 2 date time fields. Is there a better way than getting the unix timestamp and the dividing by 2 592 000 (seconds) and rounding up whithin MySQL? ...

Convert to date

Hi, I'm trying to create number of Evenement instances and set the date for them: for (int i=2004; i<2009; i++){ evenementen.add(new Evenement("Rock Werchter", "Rock", "Werchter", 200000, (Date)formatter.parse(i+"/07/03"))); But I can't seem to get it to work, Any ideas? ...

Convert a string to a date in C++

I know this may be simple but being C++ I doubt it will be. How do I convert a string in the form 01/01/2008 to a date so I can manipulate it? I am happy to break the string into the day month year constituents. Also happy if solution is windows only. ...

How to add one day to a time obtained from time()

I have a time represented as the number of seconds elapsed since midnight, January 1, 1970, UTC (the results of an earlier call to time()). How do I add one day to this time? Adding 24 * 60 * 60 works in most cases, but fails if the daylight saving time comes on or off in between. In other words, I mostly want to add 24 hours, but somet...

How to print date in a regular format in Python ?

I'm only just starting out with python so I'm still pretty clueless. What I'm trying to do is to get the date from the pc and adding it to a list. This is my code: import datetime today = datetime.date.today() print today This prints: 2008-11-22 which is exactly what I want BUT....I have a list I'm appending this to and then suddenly ...

When are API methods marked "deprecated" actually going to go away?

I'm code reviewing a change one of my co-workers just did, and he added a bunch of calls to Date.toMonth(), Date.toYear() and other deprecated Date methods. All these methods were deprecated in JDK 1.1, but he insists that it's ok to use them because they haven't gone away yet (we're using JDK 1.5) and I'm saying they might go away any ...

Crystal Reports group name error

I am grouping on a date field. The tree explorer for the report when data is displayed shows the date as 3 days before the date that is in the records. The detail in the report lists the correct date. I have verified the field shown in the report and the Group field are pointing to the same database-table-field. I have also set the forma...

Powerbuilder Date Math

How do I subtract 30 days from a date in PowerBuilder? I have the following code that returns today's date in a parameter, but I need today - 30 days: dw_1.setitem(1, "begin_datetime", datetime(today(), Now())) ...