date

Any easy ways to unformat a date?

Hi, I've got a bunch of dates in this String format: String date = "Wed Sep 15 16:31:05 BST 2010"; and I'd like to convert it back to a date or calendar object. Before I go and reinvent the wheel, are there any easy ways of doing this, preferably present in the JDK? ...

php function to get dates of last 7 weeks

I am trying to build a php function that would return an array with the start date and end date of the last n number of weeks. this would include the current week. It would look something like this: function lastnweeks(n) { //the code. I am not asking for the code itself but ideas on how to accomplish this return $array; } $lastnweeks ...

jquery issue with numbers starting wth zero

At the top of my script I have created a variable out of todays date: <?php $today = date('dmy'); ?> I then have a table and each table row has a class either of "nodate" or of a six digit number, this number represents a date. eg 230910 (yesterday). I am trying to write some jquery that hides the table row if the class (six digits) ...

Format date without year

How can create text representation of some date, that takes locale into account and contains only day and month (no year)? Following code gives me something like 23/09/2010 DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).format(date); I want to get 23/09 ...

How can I convert this date in Java?

I want to convert: 2010-03-15T16:34:46Z into something like "5 hours ago" How can I do this in Java? ...

getting the difference between date in days in java

I'm trying something like this, where I'm trying to get the date from comboboxes Calendar start = Calendar.getInstance(); Calendar end = Calendar.getInstance(); int Sdate=Integer.parseInt(cmbSdate.getSelectedItem().toString()); int Smonth=cmbSmonth.getSelectedIndex(); int Syear=Integer.parseInt(cmbSyear.getSelectedItem().toString...

How to show all days regardless of activity

I have two tables - quotes and bookings I am selecting "quote date" to show the day of the week but if a booking is made on a day without a quote, then there is no "quote date" and therefore this row is never displayed. How can I created a column that is just every day for the past 30,60 or 90 days then shows the number of quotes for t...

Number of days between two dates in jodatime

How do i find the difference in Days between two DateTime instances? with difference in days i mean if start is on Monday and end is on Tuesday i expect a return value of 1 regardless the hour/minute/seconds of the start and end dates. Days.DaysBetween(start, end).getDays() gives me 0 if start is in the evening and end in the morning. ...

jQuery -To get minDate value and set that value

Hi, I have a date field and want to set minDate for the same.There is one custom range that i have defined for beforeShowDay that make some of the date as selectable.I want to set the first selectable date using setDate function. How can i achieve the same ? e.g: when i use this on ready function, jQuery('#startDate').datepicker("setDa...

Convert date object to string in boost

Hi, Using the boost library how would I convert a date object: date d(2010,10,01); to a string with the format: DD-mmm-YYYY, so that variable d would become "01-Oct-2010". Now there are number of functions for converting a date object to a string such as std::string to_simple_string(date d) which returns a string in the ...

Incrementing a java.util.Date by one day

What is the correct way to increment a java.util.Date by one day. I'm thinking something like Calendar cal = Calendar.getInstance(); cal.setTime(toDate); cal.add(Calendar.DATE, 1); toDate = cal.getTime(); It doesn't 'feel' right. ...

SQL - Select all rows added yesterday efficiently

Hi, I want to select all of the rows added to a table which were added "yesterday" i.e. the day before whenever I choose to run the query. At the moment my query looks like this: SELECT row_date (etc) WHERE row_date >= trunc(sysdate-1) and row_date < truc(sysdate); Is there a more efficient (and, hopefully, readable) way of ...

Displaying date in MM/DD/YYYY format in Iphone Data picker

Hi. In my Application i am using the UIdatePicker with fallowing code. UIDatePicker *datePicker=[[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 480, 216)]; datePicker.timeZone = [NSTimeZone defaultTimeZone]; datePicker.datePickerMode=UIDatePickerModeDate; datePicker.date=[NSDate date]; datePicker.maximumDate=[NSDate date]; [datePi...

Order files by creation time to the millisecond in Bash

Hi there, I need to create a list of files which are located on my hard disk in order of when they arrived on the hard disk. To do so, I have used the following: ls -lat which lists all the files in date/time order, however, it only orders them to the nearest second. The problem here is that there are thousands of files and every so...

manipulating javascript date objects

I am trying to manipulate a javascript date object, to increment it by one day: var now = new Date(+1 day); What are the javascript options for something like this... EDIT: cheers ...

How to merge two dates into a normal human readable date range

Say you have the following date range: 2010-04-10 - 2010-04-15 As a human, I might write this as April 10 - 15, 2010, or something like that. Not sure if there is a defined correct way of writing ranges like that, but anyways, if you were to do something like that, how would you do that? I'm not even sure where to begin... I'd like t...

How to convert DATE to UNIX TIMESTAMP in shell script on MacOS

On Linux you can convert a date like "2010-10-02" to a unix timestamp in shell script by date -d "2010-10-02" "+%S" Since Mac OS does not have the equivalent -d for date. How do you go about converting a date to a unix timestamp in a shell script. ...

Groovy String to Date

I am coding this with Groovy I am currently trying to convert a string that I have to a date without having to do anything too tedious. String theDate = "28/09/2010 16:02:43"; def newdate = new Date().parse("d/M/yyyy H:m:s", theDate) Output: Tue Aug 10 16:02:43 PST 2010 The above code works just fine, however when my string cha...

Date on java, help on range

hey i am going to save on a file, the actual date and how much that day was paid. But i also want to get the money who was gained weekly,monthly,etc. But i don't know how to select a range on dates , for example weekly (From october 1, to October 8) and get how much money was added. I don't know if an options exists that can help me than...

PHP: Format and sort the dates from MySQL Database

Hi, I have these mysql dates in a table of my database, 2010-07-16 20:09:06 2010-08-16 20:19:43 2010-10-18 16:57:19 2009-09-18 16:57:42 2009-10-18 16:57:55 2009-12-24 14:59:21 How can I sort them into the result below so that I can have the end user browses monthly results? <h2>2010</h2> <ul> <li><a href="#">October</a></li> <li>...