Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing year in date field
Message
From
06/01/2017 06:15:36
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
06/01/2017 06:07:28
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01646327
Message ID:
01646333
Views:
58
>>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform