Choosing a Date Format

[ot] Debbie, it is the start of the New Year so how about applying the DRY(don’t repeat yourself) principle to this task?

Try creating a date function that:

  1. accepts your common date data.
  2. checks to see if the user has set a preferred date format
  3. defaults to your preferred date format.
  4. returns the formatted date.

This should drastically reduce the 20,000 lines of code.
[/ot]

Off Topic:

Too late! I already invented “The Wheel ©” in 2009-11-15 14:00:59. :stuck_out_tongue:

=======
[U]KISS[/U]: the easy dating way!
An alternative for difficult date configuration operations could be:

  • Set the date in the format which is the easiest fitting for the system operations.
  • Tell the visitor with a hoverable questionmark what format is used.

Then you can do what you like.

Note: to be complete, also the time zone and/or the AM/PM notation could be mentioned.

choosing a date format is very important.i use this date format like as -year.month.day

:vsmiley: Of course if you really want to accomodate all users, such as those that use the Islamic or Jewish calendars etc. you should consider using Unix timestamp - a long integer containing the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified - and corresponding converter classes :devil:

I know what the Unix Timestamp is, but you lost me on how that relates to Islamic and Jewish Calendars?

Debbie

Sorry, I was feeling impish and playing devil’s advocate.

Just that other cultures don’t use the same calendar, eg. for the Jewish it might be a few thousand years more, Chinese even more, Islam a few hundred years less. Some have months based on a solar cycle, some lunar. And month names are different too.

But AFAK it would be safe enough to use 2014 for your site as it will be the year for most and hopefully others will be “bi-calendar literate”.

Ha ha. Yeah, I thought you were being sarcastic! :stuck_out_tongue:

Sincerely,

Debbie

All countries now use the Gregorian calendar as their official calendar even if some groups within those countries still work to an older calendar for specific purposes. China was the last country in the world to switch to the Gregorian calendar as their official calendar about 104 years ago. Unless your application is dealing with one of those specific purposes for which an older calendar is still used (eg. the calculation of Easter) then there is no need to worry about any of those calendars.

It is now officially the 3rd or 4th (depending on timezone) of January in the common era year 2014 in every country in the world.

Yeah, so take that!! :lol: