Sort by based on time

Community Alums
Not applicable

Hi all,

 

I need to sort queried record based on time in update filed instated of date .

i have tried the below code it is sorting based on date.

var prob = new GlideRecord('problem');
        query = "sys_updatedBETWEENjavascript:gs.dateGenerate('" + startDate.getLocalDate() + "','00:00:00')@javascript:gs.dateGenerate('" + endDate.getLocalDate() + "','23:59:59')";

 

        prob.addEncodedQuery(query);
        prob.orderBy('sys_updated');
        prob.query();

 

Is there any way to do this

 

Can anyone help me on this

Thanks

6 REPLIES 6

Hi @Community Alums 

 

The problems are sorted by both date and time when ordering by sys_updated_on. 

Do you want to only sort by time and ignore dates?

Community Alums
Not applicable

Hi @Manmohan K 

 

Yes I want to only sort by time and ignore dates.

 

Thanks