date

Jsp default date format

Is it possible to change default formatting of Date object in JPS pages? Now I have some kind of formatting and I would like to change formatting without using fmt-tags, because that would mean I would have to type that formatting to all pages and there are many! ...

Objective C - convert array of objects (with date field) into dictionary of arrays (keyed by day of week)

Hello, I have an NSArray of DiaryEntry objects, where each DiaryEntry has an NSDate date_ field. I want to display all of the DiaryEntrys in a table view, grouped by the day of the week, where each group is sorted by date in ascending order. So, I need to take the NSArray, and convert to an NSDictionary of arrays, where the key is the...

Obtain a date range from a single date

I can do this myself of course, but is there built-in functionality in Ruby, or a library, that would let me do something like this date = Time.now sunday = date.week.first_day saturday = date.week.last_day Thanks ...

How to use the mysql "LIKE" syntax with a timestamp?

I want to allow my users to search the database for a row that was submitted on a certain day. The date is entered into the field in the database using the date() function which is great, but when i use the php strtotime function, of course the dates are not exactly the same. Is there some clever mysql function that can help me with thi...

PostgreSQL: change date by the random number of days

How can I change the date by the random number of days in PostgreSQL? Unfortunately http://stackoverflow.com/questions/1400505/postgresql-random-number-range-1-10 solution with trunc doesn't work: select date(now()) + (trunc(random() * 20)) results in: ERROR: operator does not exist: date + double precision LÍNEA 1: select date...

Client Side Date Conversions in GWT

I have a date that is: 2009-10-12T00:00:00 How would I convert this into UNIX Milliseconds, on the client side in GWT? Please give actual advice and not links, as a lot of the ways I have tried lead me to deprecated methods that point to non-Javascript convertible code. As GWT converts all client side Java you have written into Javas...

Nested models, forms and date_select FormHelper integration

I have followed Ryan Bates tutorial on nested models. Several of my nested models have dates associated with them. In my migrations, they are actually the type "Date." Some things I have tried and problems I've run into date_select - can handle the form object prefix, but not nested models attributes select_year - doesn't work wit...

How to format a getUpdatedAt() kind of date in Symfony?

I'd like to change the formatting of a date in Symfony 1.4 The default one being: <?php echo $question->getUpdatedAt(); // Returns 2010-01-26 16:23:53 ?> I'd like my date to be formatted like so: 26/01/2010 - 16h23 I tried using the format_date helper DateHelper class. Unfortunately the API is rather empty (something really needs ...

Need a formula: Extracting Years from Seconds Since January 1, 0001 12:00 AM

Input: # of seconds since January 1st, of Year 0001 Output: # of Full years during this time period I have developed an algorithm that I do not think is the optimal solution. I think there should be a solution that does not involve a loop. See Code Block 1 for the algorithm which A) Determines the quantity of days and B) Iteratively su...

How do I initialise a Date field in a Grails domain object to act as a timestamp?

I have a domain class which has two dates in it and I want one of them populated with the current time when a record is created for the object, like a create timestamp... class Contact { Date initiatedDate Date acceptedDate } Is it sufficient just to new a Date object on one of them and make the other nullable until such a tim...

Need Help Programming in C comparing times together..

Hi Everyone, i need some advice and help with a plugin i am writing for Nagios. i am writing the plugin in C, but have no previous experience in the language except for minor amounts whilst trying to get this plugin to work. basically what i am trying to-do is the following. read a text file that is generated on a remote PC by an appl...

jQuery - Dynamic Copyright Year

I have recently been running into alot of my clients coming to me in the last month asking me to update their Copyright on their sites to reflect 2010. Is it possible to write a small snippet with jQuery that automatically populated the year? When Jan 1st 2011 rolls around, the text would automatically change from 2010 to 2011? Thanks....

Regex DATE format validation on Java

Hello! I'm just wondering if there is a way (maybe with REGEX) to validate that an input on a java desktop app is exactly an string formated as: "YYYY-MM-DD". I've search but with no success. Thank you ...

Combining the date in order to insert it to the database

I need to combine day, month and year in PHP in order to insert it to MySQL database. How I'll combine the day, the month and the year? I'm choosing the date from a drop down menu. ...

Wrong date with ruby Date.today and DateTime.now

I've installed ruby-1.8.6-p383 with RVM. System ruby is 1.9.1_p378-1 I'm getting the wrong date from Date.today and DateTime.now when using ruby 1.8.. Whereas Time.now is correct: irb(main):002:0> DateTime.now.to_s => "2126--1-10618T11:23:43+00:00" irb(main):004:0> Date.today.to_s => "2126--1-10618" irb(main):005:0> Time.now => Thu Jan...

Easymock using date expectation

Hi, I'm mocking a method with easymock that has a date in its body, something like this: public void testedMethod() { ... if (doSomething(new Date())) { ... } And my test looks like this: public void testThatMethod() { ... expect(testedClass.testedMethod(new Date())).andReturn(false); ... } But when I run th...

PHP: Loop thru all months in date range?

if I have a start date, say 2009-02-01 and an end date say 2010-01-01. How can I create a loop to go through all the dates (months) in the range? Thanks!! ...

How can I get a table of dates from the first day of the month, two months ago, to yesterday?

I have a situation that I would normally solve by creating a feeder table (for example, every date between five years ago and a hundred years into the future) for querying but, unfortunately, this particular job disallows creation of such a table. So I'm opening this up to the SO community. Today is Jan 29, 2010. What query could I run ...

SQL To_Date table operations

Basically I have the following query that works but doesn't give the right data: SELECT a.* FROM ( SELECT a.*, rownum rnum FROM ( SELECT edate.expiration_date FROM ... ( SELECT To_Date(c.Value, 'MM/DD/YYYY HH24:MI:SS') expiration_date FROM ... ) edate ) a WHERE rownum <= 20) a WHERE rn...

Safe to convert Java.sql.date to Java.util.date by up casting?

The title says it all. Java.sql.date extends java.util.date, so is it save to convert between the two by casting a java.sql.date as a java.util.date? Or is there some other way to convert them? ...