On Wed, 24 Sep 2003, ashish srivastava wrote: > Hi > > I have 2 queries each of which return date in the following format : > dd=mon-yy:hh:mi > The results are (say) final_time and start_time. > I want to get the time difference between the 2 times(in days or hours). > Any pointers in this regard would be greatly appreciated. > > I just tried to subtract the 2 values and this is what i get : > > init_time : 17-jun-03:01::51 final time : 17-jun-03:02::00 Difference : 0 > init_time : 23-jun-03:10::19 final time : 24-jun-03:02::53 Difference : 1 > init_time : 25-jun-03:06::28 final time : 25-jun-03:02::31 Difference : 0 > init_time : 25-jun-03:11::48 final time : 01-jul-03:10::28 Difference : -24 > init_time : 02-jul-03:01::53 final time : 02-jul-03:08::57 Difference : 0 > init_time : 02-jul-03:11::37 final time : 03-jul-03:04::02 Difference : 1 > init_time : 17-jul-03:02::14 final time : 17-jul-03:07::35 Difference : 0 > init_time : 17-jul-03:07::41 final time : 17-jul-03:08::33 Difference : 0 >
You got those results due to the leading numeric portion of the strings. If you want to do date arithmetic then one solution is to use either Date::Calc or Date::Manip modules. **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs