atom feed18 messages in com.googlegroups.professional-phpRe: [Pro. PHP Dev.] Re: Date processi...
FromSent OnAttachments
Fahd MurtazaDec 4, 2007 3:32 am 
Fahd MurtazaDec 4, 2007 3:33 am 
♥ Ѐ ÕÑê & ÕÑ£¥ Thãñj襧 Hè®è ♥Dec 4, 2007 4:12 am 
Morne RoetsDec 4, 2007 4:55 am 
Fahd MurtazaDec 4, 2007 7:05 am 
SarmDec 4, 2007 9:14 am 
Sarel van der WaltDec 4, 2007 9:07 pm 
Fahd MurtazaDec 4, 2007 11:31 pm 
Fahd MurtazaDec 4, 2007 11:35 pm.php
SarmDec 5, 2007 1:06 am 
Fahd MurtazaDec 5, 2007 1:47 am.php
SarmDec 5, 2007 2:01 am 
Fahd MurtazaDec 5, 2007 2:03 am 
♥ Ѐ ÕÑê & ÕÑ£¥ Thãñj襧 Hè®è ♥Dec 5, 2007 3:42 am 
SarmDec 5, 2007 7:13 am 
♥ Ѐ ÕÑê & ÕÑ£¥ Thãñj襧 Hè®è ♥Dec 5, 2007 8:27 am 
Bhavin ParikhDec 5, 2007 8:25 pm 
SarmDec 5, 2007 10:00 pm 
Subject:Re: [Pro. PHP Dev.] Re: Date processing help
From:Fahd Murtaza (fah@gmail.com)
Date:Dec 4, 2007 3:32:13 am
List:com.googlegroups.professional-php

Check this. Make use of mktime(). The following example illustrates this. Just use mktime like this <?php // Adding 12 days to 12/32/1997 (mm/dd/yyyy) echo date("M-d-Y", mktime(0, 0, 0, 12, 32+12, 1997))."<br/>"; //Prints Jan-13-1998 on screen ?>

Thats all.

for getting mm dd and yyyy from mm-dd-yyyy or mm/dd/yyyy format you can use

date('m',"12/32/1997"); date('d',"12/32/1997"); date('Y',"12/32/1997");

respectively! Pretty easy right!

The complete example code is as below

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Date Arithmetic</title> </head>

<body> <?php echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997))."<br/>"; echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997))."<br/>"; echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998))."<br/>"; echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98))."<br/>"; echo date("m",time()); echo date("m",time());

?> <?php // Adding 12 days to 12/32/1997 (mm/dd/yyyy) echo date("M-d-Y", mktime(0, 0, 0, 12, 32+12, 1997))."<br/>"; //Prints Jan-13-1998 on screen ?> </body> </html>

On 04/12/2007, sarm@gmail.com <sarm@gmail.com> wrote:

Thanks for quick reply. I already read this site but don't understand how to do it.

Actually i have a date like 9-26-2007 in database and i want to add 30 days in it. How i can do this?

Please help.......

On Dec 4, 3:51 pm, "♥ Ѐ ÕÑê & ÕÑ£¥ Thãñj襧 Hè(R)è ♥" <than@gmail.com> wrote:

Hii, see this site and help ful for u ,,,,,,,,,,,,,,

http://www.w3schools.com/php/php_date.asp

On 04/12/2007, sarm@gmail.com <sarm@gmail.com> wrote:

Hello I want to add X days to a MM-DD-YYY date format using PHP. Please help me to write code or you anyone can send me code that would be great.

Advance thanks Sarm

•°¤*(¯`°(ßåché£Ø(R) Õƒ §oftwå(R)ê §è(R)v좣)°´¯)*¤°•