Re: [PHP] Dates and Date()
$ts = strtotime(-10 days); On Mon, 29 Jul 2002, Christopher J. Crane wrote: I believethisto be one way to find out yesterday's date: $tomorrow = mktime (0,0,0,date(m) ,date(d)-1,date(Y)); However, I would like to have a snippet of code to tell me how to get the date of today - 10 days ago. if today is jul 29, 2002, how do I get the date funtion to tell me 10 days ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from 29, but what happens if the date was jul 2, 2002. How do I get the correct date returned -- 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] Dates and Date()
On Mon, Jul 29, 2002 at 10:51:39AM -0400, Christopher J. Crane wrote: I believethisto be one way to find out yesterday's date: $tomorrow = mktime (0,0,0,date(m) ,date(d)-1,date(Y)); However, I would like to have a snippet of code to tell me how to get the date of today - 10 days ago. You have a working example of how to get yesterday. Did you even try to rework it to get ten days ago by substituting -10 for -1? What happened? --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
- Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 5:51 PM Subject: [PHP] Dates and Date() I believethisto be one way to find out yesterday's date: $tomorrow = mktime (0,0,0,date(m) ,date(d)-1,date(Y)); However, I would like to have a snippet of code to tell me how to get the date of today - 10 days ago. if today is jul 29, 2002, how do I get the date funtion to tell me 10 days ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from 29, but what happens if the date was jul 2, 2002. How do I get the correct date returned All date functions handle correctly this case so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002)); will be: 06:22:2002 You can add/substract what you wish and will get correct results in case the the resulting timestamp is between 1.1.1970 and somewhere in year 2038. Best regards, Andrey Hristov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 10:59 AM Subject: Re: [PHP] Dates and Date() - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 5:51 PM Subject: [PHP] Dates and Date() I believethisto be one way to find out yesterday's date: $tomorrow = mktime (0,0,0,date(m) ,date(d)-1,date(Y)); However, I would like to have a snippet of code to tell me how to get the date of today - 10 days ago. if today is jul 29, 2002, how do I get the date funtion to tell me 10 days ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from 29, but what happens if the date was jul 2, 2002. How do I get the correct date returned All date functions handle correctly this case so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002)); will be: 06:22:2002 You can add/substract what you wish and will get correct results in case the the resulting timestamp is between 1.1.1970 and somewhere in year 2038. Best regards, Andrey Hristov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
Use while() with some counter that increments when you have bussiness day/ $counter = 0; $bdays = 0; while ($bdays10){ if (in_array(gmstrftime('%u',gmmktime(0,0,0,7,2-($counter++),2002),array(1,2,3, 4,5)){ $bdays++; echo gmstrftime('%m/%d/%Y',gmmktime(0,0,0,7,2-($counter-1),2002); } } HTH Regards, Andrey - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 7:00 PM Subject: Re: [PHP] Dates and Date() Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 10:59 AM Subject: Re: [PHP] Dates and Date() - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 5:51 PM Subject: [PHP] Dates and Date() I believethisto be one way to find out yesterday's date: $tomorrow = mktime (0,0,0,date(m) ,date(d)-1,date(Y)); However, I would like to have a snippet of code to tell me how to get the date of today - 10 days ago. if today is jul 29, 2002, how do I get the date funtion to tell me 10 days ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from 29, but what happens if the date was jul 2, 2002. How do I get the correct date returned All date functions handle correctly this case so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002)); will be: 06:22:2002 You can add/substract what you wish and will get correct results in case the the resulting timestamp is between 1.1.1970 and somewhere in year 2038. Best regards, Andrey Hristov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
very nice... thank you! - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 12:04 PM Subject: Re: [PHP] Dates and Date() Use while() with some counter that increments when you have bussiness day/ $counter = 0; $bdays = 0; while ($bdays10){ if (in_array(gmstrftime('%u',gmmktime(0,0,0,7,2-($counter++),2002),array(1,2,3, 4,5)){ $bdays++; echo gmstrftime('%m/%d/%Y',gmmktime(0,0,0,7,2-($counter-1),2002); } } HTH Regards, Andrey - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 7:00 PM Subject: Re: [PHP] Dates and Date() Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 10:59 AM Subject: Re: [PHP] Dates and Date() - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 5:51 PM Subject: [PHP] Dates and Date() I believethisto be one way to find out yesterday's date: $tomorrow = mktime (0,0,0,date(m) ,date(d)-1,date(Y)); However, I would like to have a snippet of code to tell me how to get the date of today - 10 days ago. if today is jul 29, 2002, how do I get the date funtion to tell me 10 days ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from 29, but what happens if the date was jul 2, 2002. How do I get the correct date returned All date functions handle correctly this case so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002)); will be: 06:22:2002 You can add/substract what you wish and will get correct results in case the the resulting timestamp is between 1.1.1970 and somewhere in year 2038. Best regards, Andrey Hristov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? What have you tried? How much longer do we have to hold your hand? Not to be too rude or anything, but at least give it a few tries on your own, then post your code, what you thought would happen, what actually happened, and what help you need. That's how these things are supposed to work... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
No problema. If you have access to icq you can use irc.php.net or capek.openprojects.net (or any other openproject's irc server) on #php channel. Andrey - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 7:08 PM Subject: Re: [PHP] Dates and Date() very nice... thank you! - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 12:04 PM Subject: Re: [PHP] Dates and Date() Use while() with some counter that increments when you have bussiness day/ $counter = 0; $bdays = 0; while ($bdays10){ if (in_array(gmstrftime('%u',gmmktime(0,0,0,7,2-($counter++),2002),array(1,2,3, 4,5)){ $bdays++; echo gmstrftime('%m/%d/%Y',gmmktime(0,0,0,7,2-($counter-1),2002); } } HTH Regards, Andrey - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 7:00 PM Subject: Re: [PHP] Dates and Date() Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 10:59 AM Subject: Re: [PHP] Dates and Date() - Original Message - From: Christopher J. Crane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 5:51 PM Subject: [PHP] Dates and Date() I believethisto be one way to find out yesterday's date: $tomorrow = mktime (0,0,0,date(m) ,date(d)-1,date(Y)); However, I would like to have a snippet of code to tell me how to get the date of today - 10 days ago. if today is jul 29, 2002, how do I get the date funtion to tell me 10 days ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from 29, but what happens if the date was jul 2, 2002. How do I get the correct date returned All date functions handle correctly this case so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002)); will be: 06:22:2002 You can add/substract what you wish and will get correct results in case the the resulting timestamp is between 1.1.1970 and somewhere in year 2038. Best regards, Andrey Hristov -- 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] Dates and Date()
The guy just wanted fast help. It is obvious that he is not advanced it time transformations and functions. I think that he didn't ask bad question. WHich are bad - his questions or What the is php?. When he has more time he will take better look at the docs :)) Some people always experiment some not. Kind regards, Andrey Hristov - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 7:12 PM Subject: Re: [PHP] Dates and Date() Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? What have you tried? How much longer do we have to hold your hand? Not to be too rude or anything, but at least give it a few tries on your own, then post your code, what you thought would happen, what actually happened, and what help you need. That's how these things are supposed to work... ---John Holmes... -- 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] Dates and Date()
Maybe. You just see if to much around here where people will ask a lot of questions without ever doing any work themselves. Sometimes they get lucky and get an answer, sometimes they don't. I'm just trying to teach the guy not to take what he's getting here for granted... Either way, I'm glad you helped him and he got it figured out... ---John Holmes... - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 12:17 PM Subject: Re: [PHP] Dates and Date() The guy just wanted fast help. It is obvious that he is not advanced it time transformations and functions. I think that he didn't ask bad question. WHich are bad - his questions or What the is php?. When he has more time he will take better look at the docs :)) Some people always experiment some not. Kind regards, Andrey Hristov - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 7:12 PM Subject: Re: [PHP] Dates and Date() Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? What have you tried? How much longer do we have to hold your hand? Not to be too rude or anything, but at least give it a few tries on your own, then post your code, what you thought would happen, what actually happened, and what help you need. That's how these things are supposed to work... ---John Holmes... -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
Since you leave your name as 1LT, I am assuming that means 1st LT in what branch of the service...Army probably and the reserves no less. I am working on a huge project and write lets of code. Mostly MySql stuff. I did not know how to do this so I asked. Two people were nice enough to help out. It seems you are stuck on yourself and thought I was asking you. There are many levels in this list with over 11000 posts. Some people help people because others ask for it. If I wanted you opinion, I would have asked for it. I have received 11 emails from this list about your post and all thought you were being a jerk. If you didn't like what I was asking for you could have simply not read it or responded. Instead, you post your opinion to the entire group. You could have just sent it to me directly. It's people like you who intimidate others from sending a post or worse replying to someone in fear of someone like you who thinks they are better then everyone else. The name of this list is not EXPERTS or Only after you tried several times it is general. - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 12:12 PM Subject: Re: [PHP] Dates and Date() Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? What have you tried? How much longer do we have to hold your hand? Not to be too rude or anything, but at least give it a few tries on your own, then post your code, what you thought would happen, what actually happened, and what help you need. That's how these things are supposed to work... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates and Date()
Thank you again. Andrey Hristov [EMAIL PROTECTED] wrote in message 01ec01c2371b$77d35b20$1601a8c0@nik">news:01ec01c2371b$77d35b20$1601a8c0@nik... The guy just wanted fast help. It is obvious that he is not advanced it time transformations and functions. I think that he didn't ask bad question. WHich are bad - his questions or What the is php?. When he has more time he will take better look at the docs :)) Some people always experiment some not. Kind regards, Andrey Hristov - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: Christopher J. Crane [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 29, 2002 7:12 PM Subject: Re: [PHP] Dates and Date() Ok here is what I did. $Hist_Time = gmstrftime('%m:%d:%Y', strtotime(-10 days)); Now I am wondering if there is a way to look for only the last day business days and be returned in an array? What have you tried? How much longer do we have to hold your hand? Not to be too rude or anything, but at least give it a few tries on your own, then post your code, what you thought would happen, what actually happened, and what help you need. That's how these things are supposed to work... ---John Holmes... -- 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