Sort Date

JAVA

    Sponsored Links

    Next

  • 1. exception in thread "main" java.lang.NoClassDefFoundError on FreeBSD version of sun JDK 1.5
    I'm trying to learn java using the tutorials from java.sun.com and I was able to compile my first program, when I try to run it I get the following error message: Exception in thread "main" java.lang.NoClassDefFoundError I unset the classpath enviormental variable and tried again with no luck, so I did a web search and tried several of the solutions provided such as adding the JRE binary path to my classpath with no luck. As far as my system, I'm running FreeBSD 6.0-RELEASE and using diablo JDK 1.5, which is based on the sun JDK. Could someone please provide some assistance? Thank you for your time.
  • 2. eclipse - cannot import filesystem
    Dear Group, i have some beginner problems in eclipse, i can't import an already built (at another machine) J2EE Project into my workspace. I've already tested my environement functionallity by starting jboss server and deploying a simple project, and it works. But the new Project have different build.properties; build.xml, ant.properties and .classpath, and the hole file/folder/heading system seems to be different. There are also some .war .jar and .ear files too. So how to get it work from eclipse ? With kind regards Sergej
  • 3. Set up Visual Studio 2003 to work with JNI
    Hi all, I want to add JNI capabilities to my C-plus-plus project. I want to create a dll which I can load later into my Java Wrapper to use the native functions. Unfortunately I'm already stucking when I want to add the #include <jni.h> header file into my .cpp file. Somehow Visual Studio 2003 says when I compile that the jni.h can't be found. How can I make the VS 2003 to find the jni.h file. A short introduction to set up VS2003 to work with JNI would be very helpful. Couldn't find anything in the web. Thanks in advance for your help. Frank

Sort Date

Postby jeffsal » Sun, 21 Aug 2005 02:21:01 GMT

This sort function does not seem to work with my date format which is
1/01/2004 no leading 0 for month. Is there anything that could be
changed so it would sort properly. It is part of a Table Sort script
(sorttable.js) Thanks

function ts_sort_date(a,b) {
    // y2k notes: two digit years less than 50 are treated as 20XX,
greater than 50 are treated as 19XX
    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
    if (aa.length == 10) {
        dt1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
    } else {
        yr = aa.substr(6,2);
        if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
        dt1 = yr+aa.substr(3,2)+aa.substr(0,2);
    }
    if (bb.length == 10) {
        dt2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
    } else {
        yr = bb.substr(6,2);
        if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
        dt2 = yr+bb.substr(3,2)+bb.substr(0,2);
    }
    if (dt1==dt2) return 0;
    if (dt1<dt2) return -1;
    return 1;


Re: Sort Date

Postby Andrew Thompson » Sun, 21 Aug 2005 02:42:27 GMT




You have the wrong group, I'm afraid..
< http://www.**--****.com/ #js>

-- 
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"You can blow out a candle, but you can't blow out a fire.  Once the flame
begin to catch, the wind will blow it higher."
Peter Gabriel 'Biko'

Similar Threads:

1.sorting dates

If I had a date in the format "01-Jan-05" it does not sort properly
with my sort routine:

function compareDate(a,b)
{
var date_a = new Date(a);
var date_b = new Date(b);
if (date_a < date_b)
	{ return -1; }
	else
	{
	if (date_a > date_b)
		{ return 1; }
		else
		{ return 0; }
	}
}

I guess it expects the date in mm/dd/yyyy format.

Do I have to change:

var date_a = new Date(a);
var date_b = new Date(b);

so it recognizes a correct format?

Mike

2.Sort Date Field String

Hi:

I am already using TreeMap to massage records in my export file such that
each record has a unique key combination ( LastName + FirstName + Member
Key) .  Thus I am sorting the records by the unique key.  I also have a Date
String Field in my record ( ie "30-Apr-2005" ).  I want to create a unique
key combination of
( LastName + FirstName + Member Key + Date).

Can you please tell me what are the steps I need to do to sort the Date
String Field?  Obviously, I can't treat the date as a string field because
it will sort the date alphabetically ( ie 30-Apr-2005 will come before
30-Jan-2005 ).




Thanks  in  advance

Andrew


3.Table Sort With Dates (UK date format)

4.dates not sorted properly

I have this large array with dates in it. There is a function that sorts it
for me. The only problem is that in order for it to get sorted properly I
have to sort it AlphaNumerically first using

this first:

list_b_array = cf_array.sort(function(a,b){return
compareAlpha(a[0],b[0]);});

then this:

list_array = list_b_array.sort(function(a,b){return
compareDate(a[0],b[0]);});

to get the values in list_array properly sorted. Anyone see anything wrong
with the compareDate() function?

The array is much larger. I've just shown how the date is formatted and that
null values exist.

var cf_array = [ "","11/10/2003","11/28/2004","" ];

function compareDate(a,b)
        {
        var date_a = new Date(a);
        var date_b = new Date(b);
        if (date_a < date_b) { return -1; }
                else
                {
                if (date_a > date_b) { return 1; }
                        else
                        { return 0; }
                }

function compareAlpha(a,b)
        {
        //compare alpha charadcters
        if ( a.toLowerCase() < b.toLowerCase() ) { return -1; }
        if ( a.toLowerCase() > b.toLowerCase() ) { return 1; }
        return 0;
        }


5.How to sort files by date?

I retreived the date from FilSystemObject DateCreated property,
however its string presentation is hard to sort. How could I sort
files by date in simple way?

thx.

6. Sorting a directory content by last modify date

7. sorting vectors with Date objects

8. Javascript sorting by dates w/ character in same column



Return to JAVA

 

Who is online

Users browsing this forum: No registered users and 10 guest