anychart stock with julian date on x axis - stock

Is it possible to use a Julian date in stock graph or to show x axis with julian date format?
I try to format x axis using a function that return Julian date without any success

Related

How to convert days to datetime where time origin is 1-JAN-0000 00:00:00?

I have a netCDF dataset which includes coordinates of 'time' and 'depth'. The time coordinate has data stored in the format of days, where origin time is 'JAN1-0000 00:00:00' (Image for the dataset is attached below).
I want to know how to convert those days to correct datetime format ?
Thanks in advance!
There are 719528 days between year 0 and epoch (1970-01-01).
You can subtract those days and use to_datetime with days as unit:
time = np.array([731957.5, 731958.5])
out = pd.to_datetime(time-719528, unit='d')
output: DatetimeIndex(['2004-01-12 12:00:00', '2004-01-13 12:00:00'], dtype='datetime64[ns]', freq=None)

How to display day first with pd.to_datetime()?

I have a data frame with date columns in the format: day / month / year
They are in string/object format.
I want to convert them to datetime.
Sample date, 5th of January 2016: '05/01/2016'
However pd.to_datetime is confusing the day and month.
Here is what I've tried:
pd.to_datetime('05/01/2016')
Timestamp('2016-05-01 00:00:00')
This has given me Year - Month - Day
I want Day - Month - Year as in: 05-01-2016
What I have tried:
pd.to_datetime('05/01/2016',dayfirst=True)
Timestamp('2016-01-05 00:00:00')
This is correct, but it's not the format I want, which is '05-01-2016'
So I tried this:
pd.to_datetime('05/01/2016',dayfirst=True,format='%d/%m/%Y')
Timestamp('2016-01-05 00:00:00')
There's no difference.
How can I do it? How can I force it to display the datetime as '05-01-2016'
The only way I know is to change the display options:
pd.set_option("display.date_dayfirst", True)
https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html#available-options
but it's not working... Else you convert the datetime type to str:
ts = pd.to_datetime('05/01/2016', format='%d/%m/%Y')
print(ts)
# Timestamp('2016-01-05 00:00:00')
ts = ts.strftime('%d-%m-%Y')
print(ts)
# '05-01-2016'
Or just replace '/' by '-':
print('05/01/2016'.replace('/', '-'))
# '05-01-2016'
You can't change the timestamp format (to my knowledge), but you can convert it to string in the wanted format like so :
>>> import pandas as pd
>>> pd.to_datetime('05/01/2016', dayfirst=True, format='%d/%m/%Y').strftime('%d-%m-%Y')
'05-01-2016'

Convert string to date in databricks SQL

I have a table with a text column in the following format:
5/30/2021 9:35:18 AM
I'm trying to convert this to date(yyyy-MM-dd) but I get null values when I use cast, to_date.
Is there any way to get the above data in the yyyy-mm-dd format?
Use Databricks Datetime Patterns. According to SparkSQL documentation on the Databricks website, you can use datetime patterns specific to Databricks to convert to and from date columns. First, you need to convert the text column to a date column like this:
to_date('5/30/2021 9:35:18 AM','M/d/y h:m:s a')
M - month, d - day of month, y - year, h - hour of day (12-hour), m - minute of hour, s - second of minute, a - AM/PM
Once the column is converted to a date, you can easily use the same datetime patterns to convert it back to a specific format. Use the following command to convert it to the required format:
date_format(date to_date('5/30/2021 9:35:18 AM','M/d/y h:m:s a'), 'yyyy/MM/dd')
Note: Depending upon whether you're getting zero left padded days, months, hours, minutes, and seconds, you'll need to tweak the above command.

Use Jalali date instead of Gregorian date in patternfly-timeline

How I can use Jalali date instead of the Gregorian date in the patternfly-timeline?
This is a force for me to use Jalali in the patternfly-timeline. I mean that the x-axis should show Jalali date format.
Thanks for your help

Transform Julien date and timestamp in correct durations

I have an Oracle DB with this data (extract - there are more columns - totally)
The first is the name, the second the department.
Then there is at CJDate the JDE Julian date - Format.
And cStart and cEnds inludes the timestamp.
I would like to get the Date in the Format "DD.MM.YYYY" and the duration between cStart and cEnd in "D.HH:MM:SS".
But there are some exotics. If there are values in cEnd between 0 and 62000, the cJDate should be -1.
Is it possible to get the correct duration, if cEnd has the value 240000?Or sould it be transformed in 23:59:59 or in cJDate -1 and 00:00:00?
I use already this, to get the correct date:
DATE '1900-01-01' + FLOOR(ZZ."cJDate" / 1000) * INTERVAL'1' YEAR+
(MOD(ZZ."cJDate", 1000) -1) * INTERVAL'1' DAY AS "Date",
Does someone have any idea?
Best regards
Until now I've been using this:
select to_date(to_char(cjDate), 'YYYDDD')
from dual;
Is not julian date it's more like JDE Julian date
Example output:
118316 → 12/11/18