I'd like to format the Billable and Non Billable hours on grid from decimal to time. Lets say if the time is 3.5, the grid it should show 03:05 that is the format I would like to have. Thanks
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 an information which contains specific year and number of days. For example, 2000137 means May 16, 2000 because May 16 is the 137th day of year 2000. I need those numbers like 2000137 in the format 2000-05-16. I can do such conversion by considering how many days are in each month and how many days are in each year but I need to take the leap years into consideration and it seems too tedious to implement such code.
I wonder if there is simple function in Excel or Python to do such conversion.
You can achieve the above using Python's fromordinal and toordinal functions in the datetime library.
Try the following:
from datetime import date
ip=2000137
year=ip//1000
days=ip%1000
#days until that year
days_till_year=date(year,1,1).toordinal()
days_till_input=days_till_year+days-1
print(date.fromordinal(days_till_input))
The output would be:
2000-05-16
I wanted to convert microseconds to data:
60000000 -> 1997-2-12 (something like this).
This means the new field contains year-month-day-hour-minute-seconds-microseconds
Thx.
microseconds (or any time span) can't be directly converted to a date, because you need a starting date and then add your timespan to that date, to end up with a calculated date. Quite often, timespans expressing dates are using the unix epoch start date of January 1st, 1970, 0:00 UTC as their base date.
To calculate your target date, you could use the Calculator step from Kettle. First reverse the sign of your microseconds timespan (multiply with -1), then use the calculation Date A - Date B (milliseconds) to calculate your new date.
as your new field is a Date field, you can format the output to your own specification.
I'm trying to apply a duration format to some cells in google spreadsheet. I would like to convert an integer number in a format: X days x hours x minutes.
I've tried with some formats like: d:h:mm but i found a problem when I apply the format. It always put one day less. When I write 1 in the cell the convert to 31:0:00. When I write 2 the cells changes to 1:00:00.
That is because the duration format is actually a date / time format (for comparing dates).
If you simply enter a number (1) google will interpret that as midnight (as times are stored as fractions of whole days) of the reference day number 1.
Reference day in Google Sheets is 31/12/1899 - IE the 31st day of the month. That is why your result returns days=31.
To achieve what you want you effectively want to add 1 to your values. so that 1 (+1) actually becomes "2 days since 31/12/1899 - ie 01/01/1900 - ie 1 day, and you could then use custom format for display, but this wont work when you have >31 days.
I think the best way is to simply concatenate the data you have with relavent parts like so (where A1 is a cell containg your data - 1,2,1.5 etc):
=int(A1)&" days "&int(MOD(A1,1)*24)&" hours " & mod(MOD(A1,1)*24,1)*60 & " minutes"
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.