PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 18th, 2000, 02:05 PM
jawa_911 jawa_911 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 2 jawa_911 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello:

I have a variable ($today) that is simply

$today = date("m/j/Y");

I want to get another variable for x months down the line, but using the php.net reference of the mktime and date command, my second date, as follows comes out in a large number. How can I make sure it is forwarding the date properly, and format it like mm/dd/yyyy? Any help would be greatly apperciated.

This is the line from php.net reference page. I need this to calculate properly, and format mm/dd/yyyy - just like my variable up top.

$two_months_from_today = mktime(0,0,0,date("m")+2 ,date
("d"),date("Y"));


------------------
.·: jawatech.com :·.

Reply With Quote
  #2  
Old May 18th, 2000, 09:19 PM
cka cka is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Location: Ontario, Canada
Posts: 498 cka User rank is Corporal (100 - 500 Reputation Level)cka User rank is Corporal (100 - 500 Reputation Level)cka User rank is Corporal (100 - 500 Reputation Level)cka User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Just a suggestion, I can't really prove this theory at the moment since I have no access to a webserver with PHP, but you can set a second variable that holds a formatted date string using the "large number" generated from mktime like this:

$retval = date("m/j/Y",$two_months_from_today);

------------------
To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson

Reply With Quote
  #3  
Old May 18th, 2000, 09:30 PM
jawa_911 jawa_911 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 2 jawa_911 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by cka:
Just a suggestion, I can't really prove this theory at the moment since I have no access to a webserver with PHP, but you can set a second variable that holds a formatted date string using the "large number" generated from mktime like this:

$retval = date("m/j/Y",$two_months_from_today);

[/quote]

It works! Very nice! Thanks!



------------------
.·: jawatech.com :·.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > calculating future dates

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap