![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi Guys and Gals, I require some assistance if possible... I'm working on a website that deals with 12 month Insurance Products/Policies and I'm having trouble setting the expiry date. The obvious (to me) way of doing this would be to simply have an expiry date of <%=Date()+365%> which in itself works fine. However, for the sake (seemingly) of pure complication I can only store the details of the policy in the database (Access) with the day, month and year separately. (Clients!!!) I.e. Day: 09 Month 11 Year 2004 Using the date above, the last date of cover would be Day: 08 Month: 12 Year: 2005 Excellent! (I thought), I'll just use <%=Day(Date)-1%>, to reduce the day by one and <%=Year(Date)+1%> to increase the year by one however it then dawned on me that if someone was to make an application on the 1st of the month, this code would display a day number of "0" (eg 1 -1 = 0) Can anyone please point me in the direction of how I might achieve keeping the "day", "month", and "year" separate in the database where the start date is generated automatically as te application date and the end date is generated automatically as 12 months later? Thanks David |
#3
| |||
| |||
|
|
However, for the sake (seemingly) of pure complication I can only store the details of the policy in the database (Access) with the day, month and year separately. (Clients!!!) |
|
Excellent! (I thought), I'll just use <%=Day(Date)-1%>, to reduce the day by one and <%=Year(Date)+1%> to increase the year by one however it then dawned on me that if someone was to make an application on the 1st of the month, this code would display a day number of "0" (eg 1 -1 = 0) |
#4
| |||
| |||
|
|
However, for the sake (seemingly) of pure complication I can only store the details of the policy in the database (Access) with the day, month and year separately. (Clients!!!) That's not really the date, then. You should use an actual date field. Can you not just add a date field? Excellent! (I thought), I'll just use <%=Day(Date)-1%>, to reduce the day by one and <%=Year(Date)+1%> to increase the year by one however it then dawned on me that if someone was to make an application on the 1st of the month, this code would display a day number of "0" (eg 1 -1 = 0) If that's the case, do the calculation, and if 'day = 0' then you will need to adjust it so that: month = month -1 and: day = (number of days in above chosen month) That second calculation will be a bit trickier, as each month, obviously, has a different number of days. A final option, if you are using ASP, perhaps you can cast the the above 3 fields into one date string? -Darrel |
#5
| |||
| |||
|
|
At the end of each day all new applications will be emailed across to the underwriters of the policy by way of a CSV file. I haven't yet got round to doing the code that will create the CSV file, however I imagined that I could do it whereby the user could display a list of all new policies and then click a link to create the CSV file which they can manually email to the underwriters. |
|
It is the underwriters of the policy who require that the date be split in to the three separate sections. |
|
This being the case, if I have a date field stored in a database.. is possible that I can then display the date separated out in to three separate sections on a web page (I guess by way of a DatePart function?) |
#6
| |||
| |||
|
|
What is a CSV file? |
#7
| |||||
| |||||
|
|
I'd give my right arm to use just one single date field as this is obviously a lot easier. |
|
This being the case, if I have a date field stored in a database.. is possible that I can then display the date separated out in to three separate sections on a web page (I guess by way of a DatePart function?) |
|
Field | Type | Null | Key | Default | Extra | +-------+------+------+-----+---------+-------+ date | date | YES | | NULL | | +-------+------+------+-----+---------+-------+ |
|
date | +------------+ 2004-11-09 | +------------+ |
|
day | month | year | +------+-------+------+ 9 | 11 | 2004 | +------+-------+------+ |
![]() |
| Thread Tools | |
| Display Modes | |
| |