The countries in which Horlicks is distributed, such as the United Kingdom, tend to use the ddmmyyyy format. It stands to reason that the expiration dates of Horlicks labels use the ddmmyyyy format.
17/06/2345
The answer depends on how the date is written: ddmmyy or ddmmyyyy or mmddyy or mmddyyyy
If I were to write Feburary 1st, 2017: 01/02/2017. 'dd' is for the day. 'mm' is for the month 'yyyy' is for the year.
UNIX command to display the current datedate +'%d/%m/%Y'Niraj sharma
Regarding Jane Seymour, Henry VIII's 3rd wife: Jane's birthdate is unknown; various accounts have placed it anywhere from 1504 to 1509.
To write a date in roman numerals, you must convert the month into its numeric equivalent (January = 1, February = 2...October = 10 etc.) Then you must decide which date format to use: MMDDYYYY or MMDDYY or DDMMYY or DDMMYYYY etc. I believe it is common to follow the MMDDYYYY format. When separating each number group, you can use either a space, a dash or a period. Therefore, the date January 14, 2010 could look like I.XIV.MMX. Another way of representing the date so that there is no confusion between the month and the day is to show the month in latin: JANUARIUS, FEBRUARIUS, MARTIUS, APRILIS, MAIUS, JUNIUS, JULIUS, AUGUSTUS, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER. If you want to be as authentic as possible, Romans did not have the 'J' or 'U' in their alphabet so the months would look like: IANVARIVS, FEBRVARIVS, MARTIVS, APRILIS, MAIVS, IVNIVS, IVLIVS, AVGVSTVS, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER. The months can be shown in either upper- or lowercase. The months can be abbreviated to three letters followed by a stop, except for MART. and SEPT. In this format, January 14, 2010 could look like IAN.XIV.MMX or XIV.ian.MMX etc.
#include<iostream> #include<sstream> #include<chrono> #include<ctime> std::string months[12] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; class date { public: date (std::string = ""); date (size_t dd, size_t mm, size_t yyyy); date (const date& dt): d{dt.d}, m{dt.m}, y{dt.y} {} date (date&& dt): d{dt.d}, m{dt.m}, y{dt.y} {} date& operator= (const date& dt) { d = {dt.d}, m = {dt.m}, y = {dt.y}; return *this; } date& operator= (date&& dt) { d = {dt.d}, m = {dt.m}, y = {dt.y}; return *this; } static bool is_leap_year (size_t year); static date today (); static bool validate (size_t dd, size_t mm, size_t& yyyy); size_t day() const { return d; } size_t month() const { return m; } size_t year() const { return y; } operator std::string () const; private: size_t d; size_t m; size_t y; }; bool date::is_leap_year (size_t year) { if (!(year%4)) return false; if (!(year%100)) return true; if (!(year%400)) return false; return true; } date date::today() { time_t tt = time (nullptr); struct tm *tm = localtime (&tt); return date (tm->tm_mday, tm->tm_mon+1, tm->tm_year+1900); } bool date::validate (size_t dd, size_t mm, size_t& yyyy) { // There was no year zero! if (!yyyy) return false; // There is no day zero! if (!dd) return false; // Check day and month combinations. switch (mm) { case 2: if (dd > 29 (dd > 28 && !date::is_leap_year (yyyy))) return false; break; case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (dd > 31) return false; break; case 4: case 6: case 9: case 11: if (dd > 30) return false; break; default: return false; } // 10 dates were skipped during the switch from Julian to Gregorian if (yyyy==1582 && mm==10 && dd>4 && dd<15) return false; // The date is valid! return true; } date::date (size_t dd, size_t mm, size_t yyyy): d {dd}, m {mm}, y {yyyy} { if (!validate (dd, mm, yyyy)) throw std::range_error ("date (size_t,size_t,size_t) - invalid date values!"); } date::date (std::string ddmmyyyy) { if (!ddmmyyyy.size()) { date dd (today()); d = dd.d; m = dd.m; y = dd.y; return; } const std::string error {"date(std::string) - invalid argument!"}; const std::string valid {"0123456789\"}; // check for invalid characters if (ddmmyyyy.find_first_not_of (valid) != ddmmyyyy.npos) throw std::range_error (error); // locate first slash size_t s1 = ddmmyyyy.find('\\'); if (!s1 s1 ddmmyyyy.npos) throw std::range_error (error); // ensure no more slashes size_t s3 = ddmmyyyy.find ('\\', s2+1); if (s3 != ddmmyyyy.npos) throw std::range_error (error); // parse string std::string sd = ddmmyyyy.substr (0, s1); std::string sm = ddmmyyyy.substr (s1+1, s2-s1-1); std::string sy = ddmmyyyy.substr (s2+1, ddmmyyyy.size()-s2); std::stringstream ss; ss << sd << " " << sm << " " << sy; size_t dd, mm, yyyy; ss >> dd; ss >> mm; ss >> yyyy; if (!validate(dd,mm,yyyy)) throw std::range_error (error); d = dd; m = mm; y = yyyy; } date::operator std::string () const { std::stringstream ss; ss << d << '\\' << m << '\\' << y; return ss.str(); } int main() { date d; std::string input; while (true) { std::cout << "Enter a date (dd\\mm\\yyyy): "; std::cin >> input; try { date t {input}; d = t; break; } catch (std::range_error& e) { std::cerr << e.what() << std::endl; } } std::cout << "Date: " << d.day(); switch (d.day() % 10) { case (1): std::cout << "st"; break; case (2): std::cout << "nd"; break; case (3): std::cout << "rd"; break; default: std::cout << "th"; break; } std::cout << " " << months[d.month()-1] << ", " << d.year() << std::endl; }