How can i use Persian or Jalali or Shamsi Date in D3 or DC.js . for example if i have bar chart that X-axis contains date i want to sort the date based on Persian date that.
I don't know anything about the topic in particular but do know the concepts. So I hope this helps, but I haven't tried it.
The underlying JavaScript time type is the number of milliseconds since Jan 1 1970 UTC (the "epoch". So the sorting and difference calculations are not specific to any calendar.
It is just the Date API and D3 that use the Gregorian calendar.
There are a number of libraries to convert Jalali/Shamsi to/from epoch time and JS Dates, just do a google search e.g. for "javascript jalali date".
Build your data set by converting Jalali dates to javascript dates, and specify the format for your axis using axis.tickFormat, using the converter in the other direction.
Related
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;
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.
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.
I ran an SQL Query for Oracle which consists of Invoice date and Check date. When these data are copied on to an Excel Spreadsheet as text, it's dispayed as ex: "13-10-31" (Oct 31, 2013). However, when converted to date format, it's displayed as "10/13/1931". I've tried different date types but it always recognizes as the first part of the text as the day, then month, then year. I need these values to be setup as a date format as I need to calculate Days Payable Outstanding and other related ratios.
Is there any way to convert these values so that Excel recognizes the day, month, and year correctly? Would there be a macro that could automate this process for existing data and data that will be added in the future?
Thank you in advance.
Firstly, I hope the data type of your date column is DATE.
Secondly, the date should always have year as YYYY and not just YY. The world has already learned from Y2K bug.
If above two points are met, then while displaying use to_char(date_column, 'mm/dd/yyyy'). Thus, with YYYY format, there won't be any confusion between year and other fields.
I have an online temperature logger that publishes the date and time of last measurement in a file.
I need to find the date and time stamp in the html file using VBscript, and then check if it's older then 2 hours comparing to current time.
Example date format: 12.04.2013 16:45
You could extract the timestamp with a regular expression
\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}
However, due to the characteristics of HTML this is prone to error (line-wrapping, inline tags, …), so a better approach would be to extract the date from the HTML using DOM methods (e.g. getElementsByTagName().
Once you have the date string, you can use the DateDiff function to calculate the difference to the current timestamp:
DateDiff("h", datestring, Now)