New answers tagged

5

Update: For input data with mixed date granularity: dates = {DateObject[{2019, 11}, "Month"] -> "Month", DateObject[{2019}, "Year"] -> "Year", DateObject[{2019, 5, 15}, "Week"] -> "Week", DateObject[{2020, 10}, "Year"] -> "Year2", DateObject[{2019, 10}, "Quarter"] -> "Quarter"}; TimelinePlot[Tooltip[#, #] -> #2 & @@@ Sort[...


5

From InputForm[TimelinePlot[DateObject[{2019}, "Year"] -> "Foo"]] one can see, that MMA uses Day as granularity for DateObjects. So, one possible solution is to change these objects to the needed form: TimelinePlot[DateObject[{2019}, "Year"] -> "Foo"] /. DateObject[a__, "Day", b__] :> DateObject[a, "Year", b] Another possibility is using custom ...


1

Assuming that the file is a list of dates and that the issue isn't a formatting of the cell in Libreoffice then you could do this: file = Import[NotebookDirectory[] <> "importdate.xlsx"]; fileII = DateString[#, "ISODate"] & /@ Flatten[file]; Export[NotebookDirectory[] <> "export.xlsx", fileII] DateString will format the date as an ISO ...


2

An alternative procedure is to recognize that DateListPlot[] uses absolute time as the abscissa, and then construct a replacement rule using DateString[]. Using the same data as in C.E.'s answer: DateListPlot[Tooltip[stockPrices]] /. Tooltip[obj_, {at_, val_}] :> Tooltip[obj, DateString[at]] Use the second argument of DateString[] if you want to modify ...


6

Here's one way: stocks = {"AAPL", "FB"}; prices = FinancialData[stocks, {{2019, 11, 1}, {2019, 11, 15}}]; stockPrices = AssociationThread[stocks, prices]; tooltip[expr : {date_, value_}] := Tooltip[expr, DateString[date]] DateListPlot[ (tooltip /@ Normal[#]) & /@ stockPrices ]


Top 50 recent answers are included