Current location: Hot Scripts Forums » Programming Languages » PHP » Estimate date upon submission?


Estimate date upon submission?

Reply
  #1 (permalink)  
Old 03-14-05, 05:36 PM
ajs ajs is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Estimate date upon submission?

I have a form and one field I want on the status page is estimated completion date. It's doesn't have to be that advanced as all I want to do is simply find the current date and add one week to it based on the time they submit. If someone submitted a form today, it would estimate the completion date as March 21st, 2005. How would I do that?
Reply With Quote
  #2 (permalink)  
Old 03-14-05, 06:25 PM
JBChris JBChris is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
This code prints the date a week from now:
PHP Code:

<?php

$m 
date('m');
$d date('d');
$y date('Y');
$date mktime(0,0,0,$m,$d,$y);
$week strtotime('+1 week'$date);
print 
date('m d Y',$week);
?>
Reply With Quote
  #3 (permalink)  
Old 03-14-05, 06:36 PM
ajs ajs is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by JBChris
This code prints the date a week from now:
PHP Code:

<?php

$m 
date('m');
$d date('d');
$y date('Y');
$date mktime(0,0,0,$m,$d,$y);
$week strtotime('+1 week'$date);
print 
date('m d Y',$week);
?>
I need to have it entered into a database and stay on that date until I change it, I'm not looking for it to update the entry everyday.

Example

If you submit something today, the estimate is listed as March 21st, 2005 until I manually change it.

If you submit something tomorrow, the estimate is listed as March 22nd, 2005 until I manually change it.
Reply With Quote
  #4 (permalink)  
Old 03-15-05, 12:09 AM
STphp STphp is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
can't you just instead of printing the date in JBchris' code, just add it to a database when the form is submitted?
__________________
Shaun
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please Help me for Query by Date Range. ishaqani ASP 8 02-25-05 11:02 AM
js date franches JavaScript 1 11-25-04 08:42 AM
search form with date search newbieasp24 ASP 1 10-17-04 02:52 PM
Date andyX PHP 2 09-20-04 01:37 PM
Problem with date and form djavet PHP 3 05-02-04 12:37 AM


All times are GMT -5. The time now is 05:35 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.