How do I use ruby Date constants GREGORIAN, JULIAN, ENGLAND and even ITALY
All the constants are explained in the documentation. As a rule of thumb, if the below explanations don't mean anything to you, you probably don't need to worry about those constants at all.
ENGLAND The Julian day number of the day of calendar reform for
England and her colonies.GREGORIAN The Julian day number of the day of calendar reform for the
proleptic Gregorian calendarITALY The Julian day number of the day of calendar reform for Italy
and some catholic countries.JULIAN The Julian day number of the day of calendar reform for the
proleptic Julian calendar
Here's more info on the different calendar systems:
- http://en.wikipedia.org/wiki/Julian_calendar
- http://en.wikipedia.org/wiki/Gregorian_calendar
How do I use ruby Date constants GREGORIAN, JULIAN, ENGLAND and even ITALY
All the constants are explained in the documentation. As a rule of thumb, if the below explanations don't mean anything to you, you probably don't need to worry about those constants at all.
ENGLAND The Julian day number of the day of calendar reform for
England and her colonies.GREGORIAN The Julian day number of the day of calendar reform for the
proleptic Gregorian calendarITALY The Julian day number of the day of calendar reform for Italy
and some catholic countries.JULIAN The Julian day number of the day of calendar reform for the
proleptic Julian calendar
Here's more info on the different calendar systems:
- http://en.wikipedia.org/wiki/Julian_calendar
- http://en.wikipedia.org/wiki/Gregorian_calendar
Effect of leaving space after '-' in Ruby expression
What actually happens is this:
Date.today(-29.days) # => Fri, 07 Feb 2014
today
has an optional parameter called start
, which defaults to Date::ITALY
.
An optional argument the day of calendar reform (start) as a Julian
day number, which should be 2298874 to 2426355 or -/+oo. The default
value is Date::ITALY (2299161=1582-10-15).
Passing -29.days
to today
apparently has no effect.
Whereas:
Date.today + -29.days # => Thu, 09 Jan 2014
Which is the same as:
Date.today - 29.days # => Thu, 09 Jan 2014
DateTime and Julian Calendar - What's wrong with DateTime.ToString()?
Using an extension method:
static class JulianPrinter
{
public static string ToString(this DateTime date, string format, CultureInfo ci, Calendar cal)
{
if (format == "D")
return string.Format("{0}, {1} {2} {3}",
ci.DateTimeFormat.GetDayName(cal.GetDayOfWeek(date)),
cal.GetDayOfMonth(date),
ci.DateTimeFormat.MonthGenitiveNames[cal.GetMonth(date) - 1], //ci.DateTimeFormat.GetMonthName(cal.GetMonth(date)),
cal.GetYear(date));
return "";
}
}
...and :
var calend = new JulianCalendar();
DateTime dt = new DateTime(year, j, i, calend);
string printed = dt.ToString("D", ci, calend);
Is it possible to format/convert date for 13 month calendar (Georgian Calendar )
Divide the total seconds of the year and provide any property name for the given period.
Explain some parameters of IntlDateFormatter's constructor
Those flags specify how much information to output about the date/time. The documentation about the constants used give a little more insight than what you linked in your question.
So basically if datetype
is set to IntlDateFormatter::LONG
the output should be January 12, 1952
, or if it was set to IntlDateFormatter::MEDIUM
than the output should be Jan 12, 1952
.
Related Topics
How to Convert Character Code to What I Want
Rubymine 6.0.2, Unable to Debug
Rails Adding Multiple Objects to an Empty Array
Ruby Popen3 -- How to Repeatedly Write to Stdin & Read Stdout Without Re-Opening Process
How to HTML_Escape Text Data in a Sinatra App
Iterate Through Array of Hashes in Ruby
Why Is Heroku's Heroku-18 Stack Only Compatible with Puma Versions 3.7.X
Capture Webcam's Image with Ruby
Why Capypara + Rspect Tests Still Pass Even Though I Delete Application.Js File
Errno::Enoent No Such File or Directory Rails 4
How to Print All the Staged File Names Using Ruby Git Pre-Commit Hook
Regex for Matching All Words Between a Set of Curly Braces
Omission of Curly Braces for a Hash in an Array
How to Reduce the Quality of an Uploading Image Using Paperclip
Algorithm to Shuffle an Array Randomly Based on Different Weights