Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing year in date field
Message
De
06/01/2017 06:15:36
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
06/01/2017 06:07:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01646327
Message ID:
01646333
Vues:
59
>>>I have a table with a field called date - the year is 2016 on all records - how do I change it to 2015 on all records
>>>
>>>A simple question - I have forgotten how to do this
>>
>>replace all date with gomonth(date, -12)
>
>2016 was a leap year... I'd do manual check on existance of Feb 29 ;-)

The gomonth() function was written with such considerations taken into account, so ?gomonth({^2016-02-29}, -12) returns 28th of february - which then begs the question whether the whole pushing of the table into 2015 would make sense if it contained the 29th. At least using gomonth won't create any errors and would give regular dates as a result. However if it had records for each day of the year, then what is Colin doing cramming them into a shorter year? So it depends on the requirements, i.e. what is the more acceptable error, putting two days into one (28th and 29th into 28th) or having one day hang into either 2014 or 2016 (if he did replace all date with date-366 or with date-365).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform