473,383 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Re: default date + 180 days

"Gordon Burditt" <go***********@burditt.orgwrote in message
news:oP******************************@posted.inter netamerica...

[cross-posted to comp.lang.php for assistance]
I'd like to set the default for a date column "reserve_due" to be another
date field "reserve_serviced" plus 180 days, so that when the
"reserve_serviced" field is changed, the "reserve_due" is also updated
according to the date+180 formula:

It's generally a bad idea to put redundant information into a table.
Is there any situation, default or non-default, where reserve_due is
NOT reserve_serviced plus 180 days?
No, it is a federally mandated time interval, and we need to know the
reserve_due = reserve_serviced + 180 days at any time when examing the table
with any arbitrary 3rd-party tools. While it might be considered redundant,
it is the main reason why reserve_serviced exists, and reserve_serviced can
change at any time before the 180-day limit.

Someone might be using Toad, MS-Access (?), a database export or some other
tool to examine the table, primarily to see the reserve_due date field for
each of the hundreds of pieces of equipment in the table or to change the
reserve_serviced date field when they have serviced a particular piece of
equipment.
I'd suggest dropping the reserve_due field entirely, and when you
get data from the table, do something like:

select *, adddate(reserve_serviced, 180) as reserve_due from
gear_inventory;
if you just want to have MySQL do the date math.
Yes, thank you, we could customize a query like that and attach it to a
structure generated by phpmyedit-generated scripts, but how would we state
that in the php script which is currently recalling the reserve_due field
(which will be deleted per your advice if we can get this to work), the
relevant portion of which follows? We'd like to have the mysql-calculated
reserve_due value appear at the same place in the output:

....
$opts['fdd']['reserve_serviced'] = array(
'name' ='Reserve serviced',
'select' ='T',
'maxlen' =10,
'sort' =true
);
$opts['fdd']['reserve_due'] = array(
'name' ='Reserve due',
'select' ='T',
'maxlen' =10,
'sort' =true
);
....
Aug 20 '08 #1
0 1056

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: sandy | last post by:
Hi, Using Java script I am trying to create code where when you place in the start date it automatically calculates 6 months for the experations date. For example when I place 01/01/04 as the...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
1
by: Anna | last post by:
I am an extreme newbie to Access and need help setting a default date on a form. The situation is: I have a field called date_received which is set to default to today's date. I have another...
2
by: hyphen | last post by:
I have set up two date fields in a table: 1stpromisedDate and CurentPromisedDate The first field is to record the 1st promised delivery date of a supplier and the second is to record the...
1
by: Wayne | last post by:
Hi all I'm trying to calculate the number of days (or workdays) between 2 given dates that do not include weekend days or public holidays (public holidays are user defined from a dbase, have a...
29
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An...
4
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
7
by: No bother | last post by:
I have a table which has, among other fields, a date field. I want to get a count of records where certain criteria are met for, say, three days in a row. For example: NumWidgets Date...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.