41 votes
Accepted

Mathematica command that allows it to read my intentions

Indeed, this functionality still exists, but it has been moved into its own package. Load the package: Needs["aBetterProgrammer`"] You will have access to such ...
25 votes
Accepted

How to split a number

You can also use NumberDecompose with the basis {10000, 100, 1}: ...
kglr's user avatar
  • 395k
24 votes

Mathematica command that allows it to read my intentions

Since version 11 most commands finally support the Interpretation option: Interpretation -> "Literal" being the classical (...
24 votes

Mathematica command that allows it to read my intentions

I tend to use a pattern matching approach: myCode/.{x_?BugQ:>BugStrip[x],x_?TypoQ:>Detypo[x],x_?WrongSignQ:>-x,x_?OffBy2PiQ:>x*2\[Pi]} With the usual ...
22 votes

Mathematica cannot seem to properly handle times in the 1 hour before clocks go back

I think this looks like a bug, though I have no authority to declare it. In particular, this looks like a hot mess: That's the following: ...
Patrick Stevens's user avatar
21 votes

Mathematica command that allows it to read my intentions

This function was deprecated in V4.2, being succeeded by CellularAutomaton. Since your answer is hidden somewhere in rules like 110, why reinvent the wheel with <...
16 votes
Accepted

Reproducing the XKCD "Consensus New Year" plot

Building off the other answer, CountryData has the data for the time zones for each country, as well as their population. So we can split each country ...
SPPearce's user avatar
  • 5,663
15 votes

How to count occurrences of Friday 13th

I worked on this problem in 2015. Here is part on my notebook from that time. A not so good algorithm. ...
m_goldberg's user avatar
  • 108k
15 votes
Accepted

Check if a string is a date

The pattern "DatePattern[{"Year", "Month", "Day"}]" will match a date. You may use it e.g. inside "Select" like: ...
Daniel Huber's user avatar
  • 51.8k
14 votes

Are Easter days normally distributed?

Instead of FindFit[], DistributionFitTest[] is the function to use to test the distribution followed by your data. Using ...
14 votes
Accepted

Does Mathematica have a date region function together with operations like intersection?

Yes ... there is (undocumented) DateTime`DateInterval: ...
kglr's user avatar
  • 395k
13 votes
Accepted

How to count occurrences of Friday 13th

Select[ Table[DateObject@{2019, m, 13}, {m, 12}], DateString[#, "DayName"] === "Friday" & ] {Day: Fri 13 Sep 2019,Day: Fri 13 Dec 2019} ...
Kuba's user avatar
  • 137k
12 votes
Accepted

How to work with Date calculations?

Using Mr Wizard's data the complete list of away days is away = Join @@ DateRange @@@ Reverse @ data; The 540th most recent ...
Simon Woods's user avatar
12 votes

Are Easter days normally distributed?

First, we need to get the data, here from the website tlarsen2.tripod.com: ...
anderstood's user avatar
  • 14.3k
12 votes

Are Easter days normally distributed?

This is code to compute Easter Sunday for each year (the "Computus"), from Gauss, in the proleptic Gregorian calendar: ...
jose's user avatar
  • 6,338
12 votes
Accepted

How to convert dayname to number?

The most efficient way is not to use DayName but this: DateValue[{2012, 12, 24}, "ISOWeekDay"] Regarding Robert's comment ...
halirutan's user avatar
  • 113k
12 votes

Reproducing the XKCD "Consensus New Year" plot

While it takes a lot longer to get the data, one can go a bit more granular by using "AdministrativeDivision" rather than ...
chuy's user avatar
  • 11.2k
12 votes
Accepted

DateObject granularity conversion

DateObject itself can be used for this: date1 // FullForm ...
C. E.'s user avatar
  • 70.6k
12 votes

How to split a number

DateList[{IntegerString @ #, {"Year", "", "Month", "", "Day"}}][[;; 3]] & @ 19001231 ...
kglr's user avatar
  • 395k
11 votes
Accepted

Plotting how sunrise times change over the year

Importing and converting the data Import the data (replace "path_to_the_downloaded_file.html" with the file path of the actual ...
JungHwan Min's user avatar
  • 4,674
11 votes

How do you import "ISODateTime" and capture the time zone?

Just got hit by this 'issue', don't feel competent enough but it looks like something that should be reported. So in case you know you will get UTC time (like it is in my case, this is very common ...
Kuba's user avatar
  • 137k
11 votes

Replicating a PlotStyle from Trees, Maps, and Theorems

Try the following: (if you don't understand what an option does, leave a comment - but please look in the documentation center first) ...
Lukas Lang's user avatar
11 votes
Accepted

Is there a way to obtain the time when an input was executed in a notebook?

Update It turns out that there is a much simpler method than my previous answer. If you need the actual cell label value, than I think messing around with the ...
Carl Woll's user avatar
  • 131k
10 votes
Accepted

Acessing style information of TimeObject and DateObject DisplayForm

One can get these information using CurrentValue[{StyleDefinitions, "TimeObject", "TemplateBoxOptionsDisplayFunction"}] and ...
Karsten7's user avatar
  • 27.4k
10 votes
Accepted

Calculate moonrise

f[x_?NumberQ] := MoonPosition[DateObject[{2016, 9, 28, x}]][[2, 1]] FindRoot[f[x], {x, 12}] {x -> 17.5595} ...
corey979's user avatar
  • 24k
10 votes
Accepted

How do I plot multiple time series from a Dataset?

The query ds[All,{"Date","Column1"}] returns a list of associations whose values represent date-value pairs. The query ...
WReach's user avatar
  • 68.9k
9 votes
Accepted

How to specify RegularlySampledQ TimeSeries with EndOfMonth date unit MinimumTimeIncrement?

This is the purpose of the TemporalRegularity option. TemporalRegularity is an option for TemporalData, TimeSeries, and EventSeries that controls whether the ...
Andy Ross's user avatar
  • 19.3k
9 votes
Accepted

Different behaviour of `DateRange` between 11.2 and 11.3

Yes, this is indeed dropping the last element. One way around this behavior(at least until the issue is fixed) is to have the end-point of the range not be an "Instant" date(ie: drop the final 0 in ...
Nick Lariviere's user avatar
9 votes
Accepted

Does SolarEclipse only cover a limited date range?

When this data was originally curated, NASA was providing polygon data for a subset of the eclipses in their catalog. Since then, NASA has changed their site, and they now give the Besselian ...
Jason B.'s user avatar
  • 68.4k
9 votes

How to calculate my age

Assuming the question is related to Mathematica, the code would be DateDifference["18.03.2000", Now, "Years"] Note that DateDifference is ...
FredrikD's user avatar
  • 1,868

Only top scored, non community-wiki answers of a minimum length are eligible