Convert Excel date from date serial number to Hijri date - date

I have a large report data, 30k+ rows in Excel, their are two values which have dates, the dates are in Hijri, 80% of the dates is correct, but a few values appear in date serial number, which is 40383 instead of 1432/8/12, is there any way to convert those back to date, with this format, (yyyy/mm/dd) because I have written another function to calculate dates, and overlapping values, ...

Selection.NumberFormat = "[$-1170000]B2yyyy/mm/dd;#"

Related

Converting Date Time into standard format

I have data (240 x 9 dimensions) in which a DATETIME column has entries as shown below. I want to separate the date and time parts. Also, I need to calculate the time difference between an entry and a previous one. The date is formatted as yyyymmdd followed by the hhmmsssss. However, the last three entries of the seconds represent the decimal seconds i.e., 36200 means 36.2 seconds
Using MATLAB I have separated the date and time entries as character arrays as the original data was in the double format as below:
datestr: 240 x8 char e.g., '20190101'
timestr: 240 x9 char e.g., '001634200'
I want to convert the date into the standard format. I used
formatOut = 'yyyy/mm/dd';
date=datestr(datenum('20190101','yyyymmdd',1900),formatOut);
But getting this error : Index in position 1 exceeds array bounds (must not exceed 240).
Additionally, I need to convert the time into hh:mm:ss.sss format and then calculate the difference between a time and its previous entry.
Any help will be appreciated.

Google SHEET - Timestamp being interpreted as text - How to convert

I've a dataset in which the timestamp is in this format 03.01.2019 7:49 and the system interpret it as text.
Is there a formula to convert it to date so to divide the dataset by months (MONTH obviously is giving error in this format)
Trying to pivot the dataset by months

How to convert unix-epoch to human time in Tableau?

In the Tableau, I have a column containing the timestamps in unix-time format, which I wish to convert it to Human time.
Is it possible to use R script in Calculated Field for such time conversion?
Tableau screenshot
I think you should create a new calculated field like this:
New_date = dateadd('second',[Time],#1970-01-01#)
Or if [Time] is in milliseconds then just divide it by 1000 to convert to seconds before passing it to dateadd of course

Converting a date/math formula in Excel into Numbers for Mac

I have a formula in Excel that subtracts a birth date from today's date and divides by 365 which gives the age in decimal format. Example below.
B4 is equal to birthday of 10/03/2011.
E4 is today's date.
The result is 2.73. My child is a little over 2 and 1/2.
=IF(B4>0,(E$4-B4)/365," ")
When I try to use this formula in Numbers for Mac, it gives me an error about comparing dates with numbers and so. I looked at DatedIF, TimeValue, and DateValue but couldn't figure out how to do it in Number.
Anyone know how I could get this formula to return a decimal value of 2.73 years of age?
Assuming B4 is in "date" format, you could try the following formula
=IF(ISBLANK(B4),"",YEARFRAC(B4,TODAY(),1))
Here is some documentation on YEARFRAC from the horse's mouth
Try entering the formula
=B4>0
in a different cell, you will then encounter en error
You can’t compare a date with a number because their data types are different.

Convert cell to date in matlab using datenum?

I have a matrix containing the date in a cell structure. I managed to convert the date (2nd column) using datenum(), but I am not sure how to add on the time (3rd column)
The data looks like this:
'IBM' 20090602 0 108.410000000000
'IBM' 20090602 500 108.560000000000
My code:
date = datenum(num2str(IBM(:,2)),'yyyymmdd')
Let's review your mistakes first:
You feed datenum with the string 'IBM(:, 2)' instead of the actual array. Discard the quotes.
datenum accepts strings, not numerical values.
A possible solution is converting the second column of your data into an array of strings, and feeding it into datenum, like so:
d = datenum(num2str(vertcat(IBM{:, 2})), 'yyyymmdd');
Note that this is, of course, possible only if the format of the date string is fixed in each row.
EDIT:
To add the values in the third column to the result of datenum, simply do the following:
d + vertcat(IBM{:, 3})
Where d is a column vector of date values obtained from datenum (I assume that you want to do basic addition, since you haven't specified the actual meaning of the timje values in the third column).
In one line, the complete answer would look like this:
datenum(num2str(vertcat(IBM{:, 2})), 'yyyymmdd') + vertcat(IBM{:, 3})
You can straight-up add the time values in when you're converting to datenum. Just convert from what I assumed were minutes (if they're in seconds, add in another *60 to the divisor) to days, which is what MATLAB uses for its datenum calculations.
timestamps = cellfun(#(x,y) datenum(num2str(x),'yyyymmdd')+y/(24*60),...
IBM(:,2),...
IBM(:,3),...
'UniformOutput',false)