Bienvenue, Invité
Nom d'utilisateur : Mot de passe :
Before asking for help please read "How to request help" by clicking on that tab above here.
  • Page :
  • 1

SUJET : Displaying date over 2038

Displaying date over 2038 il y a 1 mois 3 semaines #1

Hi all ,
what is the function do I have to use to (for example) add 20 years to a date and be able to display a date over 2038

For example :
I would like :
  1. To define a special date
  2. Add 20 years to that date
  3. Display it with Month & Years, even if the date is over 2038

If I use $date->display('d-m-Y') I only print the year with the link to the calendar. It's not what I expect.

Could someone help me .... event if I'm not good enough in php

Connexion ou Créer un compte pour participer à la conversation.

Displaying date over 2038 il y a 1 mois 3 semaines #2

  • bertkoor
  • Portrait de bertkoor
  • Hors Ligne
  • Gold
  • Gold
  • Greetings from Utrecht, Holland
  • Messages : 1858
For adding years, see www.w3schools.com/php/func_date_date_add.asp
I doubt it is of much use, since in webtrees the PHP date objects are not used that much (I think...)

The year 2038 limit bug should be fixed, unless you run an ancient PHP version in 32bit.
See ourcodeworld.com/articles/read/600/what-...-and-how-to-solve-it
stamboom.BertKoor.nl runs on webtrees v1.7.13

Connexion ou Créer un compte pour participer à la conversation.

Dernière édition: par bertkoor.

Displaying date over 2038 il y a 1 mois 1 semaine #3

  • fisharebest
  • Portrait de fisharebest
  • Hors Ligne
  • Administrator
  • Administrator
  • Messages : 12924
There are many different types of date.

GEDCOM dates. e.g.

$d = new \Fisharebest\Webtrees\Date('20 JAN 2040');
echo $d->display(false, '%d-%m-%Y'); // 20-01-2040

But you ask about 2038. GEDCOM dates are not affected by the 2038 problem.

So, perhaps you are talking about date-time objects. e.g.

$d = \Fisharebest\Webtrees\Carbon::now()->addYears(20);
echo $d->format('d-m-Y'); // 14-04-2040
Greg Roach - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser. - fisharebest.webtrees.net

Connexion ou Créer un compte pour participer à la conversation.

  • Page :
  • 1
Propulsé par Kunena