jqGrid search - Convert search input from date string to epoch integer before performing search - jqgrid

I have a column that displays date strings such as "04/28/2017 3:00 PM". The data for this column are actually integers (epoch) such as "1493411432". jqGrid allows me to define a formatter to generate the date strings from epoch values for display in the grid column. The problem is that if a user wants to specify in the search dialog something like "End Time greater than "04/28/2017 3:00 PM"", it won't work because "04/28/2017 3:00 PM" will be compared with the interval epoch values. Does jqGrid provide any hook such that I can convert the date string to its corresponding epoch value which can then be used by jqGrid to do the search? Any other suggestions will also be appreciated.

If I examine Date(1493411432) the Apr 28 2017 23:03:32 GMT+0200. If you want to allow the user to filter (to search) for such dates then you should solve one more problem: to filter for date ignoring the time (or at least seconds or other minor parts of the time).
Relatively simple and flexible solution of the problem exist in free jqGrid fork of jqGrid, which I develop. It provides custom filtering feature, which get you full control to define custom searching/filtering operation and to define how it should be implemented.
Try the demo, which I created for the answer. You can filter for 4/15/2015. I think that it's very close to what you need and you can easy modify the code corresponded your requirements.

Related

SSRS Date Formatting and European numbers

I created a number of fields in order to sort out why I couldn't easily format my date field as a date (it is date in the database, but with FetchXML it seems to lose the formatting. I know this should be accomplished with nested formulas, but since I kept having errors, I wanted to understand where the problem was exactly.
Date is "CreatedOn" : dd/MM/yyyy hh:mm:ss
I created a field called "SignUpLeft" with this expression:
=Left(Fields!createdon.Value,10)
I created another field, and I called this "Cdate":
=Format(CDate(Fields!SignDateLeft.Value),"dd/MM/yyyy")
I have my report sorting by the "Cdate" field, but it is sorting by the Day, rather than by the month (see pic below.) I have changed the report attribute localization to "es-es".
What else can I do to get the date formatted correctly, in order to sort.

Changing format of date without using to_char - Oracle

I have to get the max payment date on an invoice and I am having trouble with the date format. I do not need the max in this formula as I am using the format in a reporting tool that is pulling the max from what it finds for me.
Using "to_char({datefield},'mm/dd/yyyy')" works for displaying that date the way we would like BUT when you use summary function MAX it does not pull the correct date because it is looking at a string and not a date (it will think 12/3/21 is larger than 3/2/22).
Another thing I have tried is trunc - "trunc({datefield})" which gives us the correct max date but it changes the formatting. For example if the date prior to the formula being applied is "8/12/21 12:00:00:000" the trunc formula will display it as 12-08-21 which is horribly wrong.
Long story short is I need a way to change a date/time to date with the format of 'mmmm/dd/yyyy' WITHOUT converting it to a string with something like to_char. Thank you!!!!
A DATE is a binary data type consisting of 7 bytes representing: century, year-of-century, month, day, hour, minute and second. It ALWAYS has all of those components and it is NEVER stored with any (human-readable) format.
What you are seeing when a date is displayed is the client application you are using to access the database making a decision to be helpful to you, the user, and display the binary DATE provided by the database in a human-readable format.
If you want to change how the DATE is displayed then you either need to:
Change the settings on the client application that controls how it formats dates when it displays them to you; or
Change the data-type so that it is no longer a DATE (which does not have a format) to a data type where the values of the date can be formatted (such as a string). You can do this using TO_CHAR.
If you want to find the maximum then do it BEFORE applying the formatting:
SELECT TO_CHAR(MAX({datefield}),'mm/dd/yyyy')
FROM your_table;

Sort Google Sheets spreadsheet by date, not by string

I use Google Sheets to keep a list of applications I am doing. In each row there is a date field. I want to sort by date now. The first row is frozen using View - Freeze - 1 row. When I select the whole table, press Data - Sort range... and then check Data has header row the sheet is sorted. But not by date but by string. The format of the cells is date. Is only string sorting possible? If yes, I would have to reformat the whole document to dates like 2017-01-11, correct?
The solution was to replace the . by /. Seems as if the common german format using . is not yet supported. Make sure the date is recognized as date. If the cell is right-aligned it worked, if not it did not work.
I learned that you can create a custom date format using the ..
Now the date is entered 10/01/2017 but displayed 10.01.2017. Just the way I wanted.

Filter by date in Qlik Cloud

I have sheet in Qlik Cloud, where I have dataset from whole month. I would like to filter this dataset by date or time - 1 day, 1 week, 12 hours... column with date/time in format yyyy/mm/dd hh:mm:ss is in dataset for each row. Is possible insert some calendar? Or have you any idea?
Thanks for your answers ;)
Provided that your data is loaded correctly, drag the field directly onto the sheet. This will create a look-up box that can be searched.
You can see if the field has been identified correctly as a date as it will appear like this on the field selector
Another Option
Create a filter box option and add your date field to it, the benefit of this is that you can have multiple filters in one place. Allowing users to pick the part of the date relevant to them. For example showing the year field, the month field and the date field in one
one more option
Using non-standard Qlik extensions you can achieve the functionality that you require. SenseDateRangePicker is an extension that provides extended date selection functionality.

Xpages sorting date

I'm stuck with sorting and showing the correct date in Xpages.
It is saved in format "dd.MM.yyyy" and it's a string.
Now why it's a string and formated that way, is because my boss has special wishes. And when I want to sort it from the newest date to older it does something like this:
26.05.2015
24.06.2014
22.04.2015
21.04.2015
20.03.2014
It starts sorting by day.
Is there a way to make it sort it like it should?
I see that i can write a Computed value to Sort column in view column header for date. But i don't know how to even start.
Change the underlying Notes view to get your date column into right order.
Convert the date strings to real date values in views column formula. Assuming your field is called DateText then your formula would be
#Date(#ToNumber(#Right(DateText; 4));
#ToNumber(#Middle(DateText; 3; 2));
#ToNumber(#Left(DateText; 2)))
It would be easier to use just #ToTime(DateText) but this can fail depending on server's local settings. Your date string format would work for a server with German locale settings but not for US. That's why is my suggested solution "safer".
If the date time value doesn't solve your problem and you do not transform your date via #Text (as mentioned in the comments) then create another (hidden) column BEFORE your column that should be displayed. Make this a true date (from your item), sort it and unsort the column to display.
Otherwise use this formula in the newly created sorted column:
#Text(#Year(yourDate))+"-"+#Right("00"+#Text(#Month(yourDate));2)+"-"+#Right("00"+#Text(#Day(yourDate));2)

Resources