Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get current date time in encoded query in UI action

shilpa344
Giga Expert

Hi All,

I am created one UI action which query another custom table to fetch some data. I have created some query to filter the data.

Now i wanted to filter data on the basis of date but date field in custom table is string instead of Date/Time.

Any ideas how to filter records on the basis of date.

u_effort=false^u_process=85c1619b6fa8e60061e201ccbb3ee445^u_date>=2016-07-22

This u_date is the date field in the custom table which I am querying and i wanted display latest records where date should be greater then equal to current date.

5 REPLIES 5

Chuck Tomasi
Tera Patron

Any chance of converting that date (string) in u_date in to an actual date field? Without it, it's going to be difficult, if not inconsistent.


Chuck Tomasi
Tera Patron

As long as the dates are the same yyyy-mm-dd format, your less than or greater than comparison will work.


Hi Chuck,



No chance to convert in date field but format of date field is consistent i.e. yyyy-mm--dd.


I did a quick test and found that, as long as the format is consistent in yyyy-mm-dd format, you can do > and < operations since the string is able to sort correctly. If you use another format such as mm-dd-yyyy it won't sort.



(Which is why I always name my filenames with yyyy-mm-dd or yyyymmdd format.)