Re: [PHP] Re: Date Question [SOLVED]
Thanks guys. On 17/03/06, João Cândido de Souza Neto <[EMAIL PROTECTED]> wrote: > > select date_format(date,"%d/%m/%y") as date from table > > It'll show in 17/03/06 format > > select date_format(date,"%d/%m/%Y") as date from table > > It'll show in 17/03/2006 format > > > Tom Chubb wrote: > > > Please can you help me. I've created a page where problems are posted > into > > a database and I am using the datetime format in MySQL and trying to > find > > the best way to display it in the 17/03/06 format. > > I've found a way of doing it (so you don't think I haven't googled, > RTFM) > > but don't think it's the best way. > > Any help would be appreciated. > > > > (Current Code:) > > > > > $datestr = $row_rsSnags['date']; > > $arr1 = str_split($datestr, 2); > > echo $arr1 [2]; > > echo "/"; > > echo $arr1 [1]; > > echo "/"; > > echo $arr1 [0]; > > // echo $row_rsSnags['date']; > > ?> > > -- > --- > João Cândido de Souza Neto > Web Developer > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Tom Chubb [EMAIL PROTECTED] 07915 053312
[PHP] Re: Date Question
select date_format(date,"%d/%m/%y") as date from table It'll show in 17/03/06 format select date_format(date,"%d/%m/%Y") as date from table It'll show in 17/03/2006 format Tom Chubb wrote: > Please can you help me. I've created a page where problems are posted into > a database and I am using the datetime format in MySQL and trying to find > the best way to display it in the 17/03/06 format. > I've found a way of doing it (so you don't think I haven't googled, RTFM) > but don't think it's the best way. > Any help would be appreciated. > > (Current Code:) > > $datestr = $row_rsSnags['date']; > $arr1 = str_split($datestr, 2); > echo $arr1 [2]; > echo "/"; > echo $arr1 [1]; > echo "/"; > echo $arr1 [0]; > // echo $row_rsSnags['date']; > ?> -- --- João Cândido de Souza Neto Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date question
Yep. Nevermind... (and back to sleep) ""William Stokes"" <[EMAIL PROTECTED]> kirjoitti viestissä:[EMAIL PROTECTED] > Hello, > > I have a datetime column in MySQL DB. How can I match to that column from > php code if I only have the date information available. > > 2006-02-24 12:00:00 against2006-02-24 > > This might be more SQL question sorry about that. > > Thanks > -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Question.
Thank you very much, That worked well. warm regards, Sebastian. - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: "Sebastian" <[EMAIL PROTECTED]>; "Philip Hallstrom" <[EMAIL PROTECTED]> Cc: "php list" <[EMAIL PROTECTED]> Sent: Wednesday, March 05, 2003 2:38 PM Subject: Re: [PHP] Re: Date Question. | He's recommending something like this.. | | $tmp = explode(' ', $date); | if (date("Y-m-d") == $tmp[0]) // date format -mm-dd | { | echo "Today"; | } | | Seems like a reasonable solution to me. Read the manual if you need more | information.. | http://www.php.net/manual/en/function.explode.php | http://www.php.net/manual/en/function.date.php | | - Kevin | | | - Original Message - | From: "Sebastian" <[EMAIL PROTECTED]> | To: "Philip Hallstrom" <[EMAIL PROTECTED]> | Cc: "php list" <[EMAIL PROTECTED]> | Sent: Wednesday, March 05, 2003 12:32 PM | Subject: Re: [PHP] Re: Date Question. | | | > can you give an example? I am stil learning :) | > | > - Original Message - | > From: "Philip Hallstrom" <[EMAIL PROTECTED]> | > | > | > | Strip off the H:i:s part using explode() and use date() to get an | > | equivalent string for right now and if they match, today's the day. | > | | > | On Wed, 5 Mar 2003, Sebastian wrote: | > | | > | > I have a date field in mysql in this format: Y-m-d H:i:s | > | > | > | > I would like to echo "Today" if the date is today, can someone offer | > some | > | > help? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Question.
He's recommending something like this.. $tmp = explode(' ', $date); if (date("Y-m-d") == $tmp[0]) // date format -mm-dd { echo "Today"; } Seems like a reasonable solution to me. Read the manual if you need more information.. http://www.php.net/manual/en/function.explode.php http://www.php.net/manual/en/function.date.php - Kevin - Original Message - From: "Sebastian" <[EMAIL PROTECTED]> To: "Philip Hallstrom" <[EMAIL PROTECTED]> Cc: "php list" <[EMAIL PROTECTED]> Sent: Wednesday, March 05, 2003 12:32 PM Subject: Re: [PHP] Re: Date Question. > can you give an example? I am stil learning :) > > - Original Message - > From: "Philip Hallstrom" <[EMAIL PROTECTED]> > > > | Strip off the H:i:s part using explode() and use date() to get an > | equivalent string for right now and if they match, today's the day. > | > | On Wed, 5 Mar 2003, Sebastian wrote: > | > | > I have a date field in mysql in this format: Y-m-d H:i:s > | > > | > I would like to echo "Today" if the date is today, can someone offer > some > | > help? Thanks. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Question.
can you give an example? I am stil learning :) - Original Message - From: "Philip Hallstrom" <[EMAIL PROTECTED]> | Strip off the H:i:s part using explode() and use date() to get an | equivalent string for right now and if they match, today's the day. | | On Wed, 5 Mar 2003, Sebastian wrote: | | > I have a date field in mysql in this format: Y-m-d H:i:s | > | > I would like to echo "Today" if the date is today, can someone offer some | > help? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Question.
Strip off the H:i:s part using explode() and use date() to get an equivalent string for right now and if they match, today's the day. On Wed, 5 Mar 2003, Sebastian wrote: > I have a date field in mysql in this format: Y-m-d H:i:s > > I would like to echo "Today" if the date is today, can someone offer some > help? Thanks. > > warm regards, > Sebastian - [BBR] Gaming Clan > http://www.broadbandreports.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: date question
> From: "Jonas Geiregat" <[EMAIL PROTECTED]> > Sent: Sunday, September 29, 2002 10:56 AM > Subject: [PHP] Re: date question > and If I want to calculate from given date the next month > like strtotime("next month") gives me the date of one month in advanced > from NOW > but I want to get the date one month in advanced from a given date not NOW If you have mysql lying around, it has a bunch of date functions that can do what you want: http://www.mysql.com/doc/en/Date_and_time_functions.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date question
and If I want to calculate from given date the next month like strtotime("next month") gives me the date of one month in advanced from NOW but I want to get the date one month in advanced from a given date not NOW Jonas Geiregat wrote: > I have a date ex 24/08/02 > and I need to see if that date is the same date as it is today (only one > month later) but 5day's in advanced => that would be 24/09/02 > so if(date == date now - 5) > {true} > else{false} > > how can I do this right ? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date question
Jonas Geiregat wrote: > > I have a date ex 24/08/02 > and I need to see if that date is the same date as it is today (only one > month later) but 5day's in advanced => that would be 24/09/02 > so if(date == date now - 5) > {true} > else{false} > > how can I do this right ? Look at the online docs and read up on date() and strtotime() which can accept things like (today - 5days) as arguments. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date question
oradaki bir gun kavramini biraz daha açarsan yardim edebilirim - umarim - timestamp mi yoksa baska -daha özel bir- formatta mi ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date question
Meltem Demirkus wrote: > Hi, > > Is there any function which returns the day , month or year of a > date ? You need two functions actually ;-)) use the date() function to generate the day, month or year from a timestamp use the strtotime() function to generate a timestamp from a date For example HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Question: finding 1st Monday of sept.
Nevermind, I figured it out, didn't see that you could pass a timestamp to strtotime. Thanks. On Fri, 2002-02-22 at 14:22, Jeff Bearer wrote: > Hello, > > I'm trying to find out how to calculate some dates, and the part I'm > having problems with is finding the date of the first Monday in > September. > > I'm looking into the strtotime() function which works some great magic > with dates, but I can't figure out how to use the day of the week syntax > start from a date other than today. > > You can use releative dates with units of days: > strtotime("2002-09-01 +2 weeks"); > > But I can't seem to get it to work with the weekdays, I'd assume it > would be something like this. > strtotime("2002-09-01 first monday") > > Is there a syntax that I'm missing or is there a way of fooling the > function to thinking it is September 1st so when I ask for next Monday > it will give me the correct date? > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php