Re: date and time operation

From: Date: Fri, 17 Jan 2003 08:08:36 +0000
Subject: Re: date and time operation
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-17929@lists.php.net to get a copy of this message
By any chance have you looked at the date() function in PHP? Check the manual at http://www.php.net/manual/en/function.date.php. date() pairs up nicely with checkdate and with mktime (http://www.php.net/manual/en/function.mktime.php). Thusly, Use the following examples: $year = date("Y"); //4 digit year $year = date("y"); //2 digit year $mon = date("M"); //Jan, could also use n for 1-12, m for 01-12, etc etc etc. To make a date/time whatever for another day, you should use mktime() and feed it the variables (note that it's a little oddly ordered...). When in doubt, RTFM! :) (there are so many options to date() that I keep a printed up copy nearby!) -Dash Where there's a will, there's an Inheritance Tax. On Fri, 17 Jan 2003, Ha Duy Thien wrote: > Hello everybody ! > > Does anybody here deal with date and time operation in php ? > > If you don't mind, please show me they way to do this. I have some date and > time functions in ASP and now I have to convert it to PHP. > > Here are some functions in ASP > > yr = year(date()) > mon = month(date()) > > currentmonth = cdate(yr & "-" & mon & "- 1") > start_week = weekday(currentmonth) > > nextmonth = cdate(yr & "-" & nextmon & "- 1") > > first_start_week = dateadd("d", 7, currentmonth) > > ff_end_week = dateadd("d", -1, first_start_week) > > diffaweek = datediff("w", first_start_week, nextmonth) > > day(currentmonth) > day(ff_end_week) > > > Do you have any date and time class written in PHP, please share with me > > Thanks you very much for your attention > > Thien > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.windows (#17929) next »