Click here to Skip to main content
15,878,953 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
Dear All how to compare object checkintime and get lowest time from arraylist
JavaScript
var tbl_A=[{
	'eid': 1,
	'checkintime': '10:05:00',
	'checkouttime': '02:05:00',
	'Day':'Sunday',
	'Date': '27-04-2014'
	},
	{
	'eid': 2,
	'checkintime': '02:30:00',
	'checkouttime': '04:25:00',
	'Day':'Friday',
	'Date': '25-04-2014'
	},
	{
	'eid': 3,
	'checkintime': '04:30:00',
	'checkouttime': '06:34:00',
	'Day':'Thusday',
	'Date': '24-04-2014'
	},
	{
	'eid':1,
	'checkintime': '09:58:00',
	'checkouttime': '02:15:00',
	'Day':'Sunday',
	'Date': '27-04-2014'
	},
	{
	'eid':2,
	'checkintime': '02:45:00',
	'checkouttime': '04:40:00',
	'Day':'Friday',
	'Date': '25-04-2014'
	},
	{
	'eid':3,
	'checkintime': '05:02:00',
	'checkouttime': '06:15:00',
	'Day':'Thusday',
	'Date': '24-04-2014'
	},
	{
	'eid':1,
	'checkintime': '09:45:00',
	'checkouttime': '02:00:00',
	'Day':'Sunday',
	'Date': '27-04-2014'
	},
	{
	'eid':2,
	'checkintime': '02:15:00',
	'checkouttime': '04:40:00',
	'Day':'Friday',
	'Date': '25-04-2014'
	},
	{
	'eid':3,
	'checkintime': '04:55:00',
	'checkouttime': '06:01:00',
	'Day':'Thusday',
	'Date': '24-04-2014'
	}
	];


above is my arraylist i want to compare my checkintime as per eid and want low time pls let me know with code
Posted

1 solution

Hello,

A similar question has already been asked. Please check How to compare two dates using Javascript or Jquery[^]

FYI: Please correct "Thusday" if that is on your original code.

Do a for/while loop on your dates and check on how to compare it. This shouldn't cause you any trouble. At worst, some time will be wasted :P
Also, codeproject already has a vast library of articles/tips and questions/answer with examples, please check before posting a question. Usually you will find your answer much faster than wainting for someone to answer.

regards,
 
Share this answer
 
Comments
Arjunwalmiki 6-May-14 1:29am    
Paulo Augusto Künzel thank you for reply But i know codeproject vast library of articles but i am new so i don't know how to compare object in same arraylist if you know so pls help me i need lowest checkintime as per ID if yyou know pls help me
Paulo Augusto Kunzel 7-May-14 7:20am    
Hello Arjunwalmiki,

I may have jumped the explanation step, for that I apologize.

I think that is what is causing the issue for you. Please consider trying to compare dates instead of objects, it will be much easier.

In case of having difficulties to compare dates or creating dates for that matter, please have a look on the link I provided you in your answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900