Re: [PHP] Dates and Mysql

2008-12-10 Thread Kevin Waterson
This one time, at band camp, VamVan <[EMAIL PROTECTED]> wrote: > I was wondering how is it possible for me to query the table to retrieve all > the records that are one week less than the time stamp? SELECT DATE_SUB(date_time_column, INTERVAL 1 WEEK) FROM your_table; http://www.phpro.org/tutoria

Re: [PHP] Dates and Mysql

2008-12-10 Thread Chris
VamVan wrote: Hello Gang, I have a Mysql table which has timestamp for the date the record was created. I was wondering how is it possible for me to query the table to retrieve all the records that are one week less than the time stamp? http://dev.mysql.com/doc/refman/5.0/en/date-and-time-fun

Re: [PHP] Dates and Mysql

2008-12-10 Thread Micah Gersten
VamVan wrote: > Hello Gang, > > I have a Mysql table which has timestamp for the date the record was > created. > > I was wondering how is it possible for me to query the table to retrieve all > the records that are one week less than the time stamp? > > Thanks, > V > > I'm assuming you meant g

Re: [PHP] Dates Again

2008-03-31 Thread Larry Garfield
On Monday 31 March 2008, Zoltán Németh wrote: > VamVan írta: > > Hello All, > > > > I have a date in 2008-03-29 12:15:00 format. > > > >- How can I reduce one day from it? > >- How can I reduce one hour from it? > >- How can I add 1 hour to today's date? > > > > Thanks > > just convert

Re: [PHP] Dates Again

2008-03-31 Thread Ray Hauge
Zoltán Németh wrote: VamVan írta: Hello All, I have a date in 2008-03-29 12:15:00 format. - How can I reduce one day from it? - How can I reduce one hour from it? - How can I add 1 hour to today's date? Thanks just convert it to a timestamp with strtotime() then you can manipulat

Re: [PHP] Dates Again

2008-03-31 Thread Zoltán Németh
VamVan írta: Hello All, I have a date in 2008-03-29 12:15:00 format. - How can I reduce one day from it? - How can I reduce one hour from it? - How can I add 1 hour to today's date? Thanks just convert it to a timestamp with strtotime() then you can manipulate it by adding/substra

Re: [PHP] Dates and different time zones

2007-04-10 Thread Richard Lynch
On Tue, April 10, 2007 11:38 am, Satyam wrote: > In PHP dates are stored as seconds from an arbitrary zero set at Jan > 1st, > 1970, so does MySql with date/time values though it shows them > formatted but nitpick: I don't think MySQL uses Unix timestamp internally, as it's quite capable of storin

Re: [PHP] Dates and different time zones

2007-04-10 Thread Richard Lynch
On Tue, April 10, 2007 11:49 am, Satyam wrote: > You are totally right, I am sorry. I would hate to miss my plane or > train > due to such mistake. Can somebody with way more karma than me put in an RFC to just NUKE daylight savings? Pretty please? Thanks! Whatever alleged benefits there are,

Re: [PHP] Dates and different time zones

2007-04-10 Thread Satyam
You are totally right, I am sorry. I would hate to miss my plane or train due to such mistake. Satyam - Original Message - From: "Lester Caine" <[EMAIL PROTECTED]> To: Sent: Tuesday, April 10, 2007 6:29 PM Subject: Re: [PHP] Dates and different time zones Satyam

Re: [PHP] Dates and different time zones

2007-04-10 Thread Satyam
- Original Message - From: "Niklas Karlsson" <[EMAIL PROTECTED]> To: Sent: Tuesday, April 10, 2007 5:32 PM Subject: RE: [PHP] Dates and different time zones Thanks for good answers. Okay, so I should set the default time zone to central GMT time, and then save GMT

Re: [PHP] Dates and different time zones

2007-04-10 Thread Lester Caine
Satyam wrote: Of cause the major fault with this is that it can only display the CURRENT time offset. You *ALSO* need the users Daylight Saving Zone as well. This has been giving us great fun since the winter dates and times need a different offset to the summer ones. Something that simplisti

Re: [PHP] Dates and different time zones

2007-04-10 Thread Richard Davey
Niklas Karlsson wrote: Okay, so I should set the default time zone to central GMT time, and then save GMT offset for every user. This sounds realistic, because I don't think that I need to correct the time for users that doesn't login. So, if I now have the GMT offset for every user, how do I d

RE: [PHP] Dates and different time zones

2007-04-10 Thread Niklas Karlsson
Thanks for good answers. Okay, so I should set the default time zone to central GMT time, and then save GMT offset for every user. This sounds realistic, because I don't think that I need to correct the time for users that doesn't login. So, if I now have the GMT offset for every user, how do I di

Re: [PHP] Dates and different time zones

2007-04-10 Thread Satyam
- Original Message - From: "Lester Caine" <[EMAIL PROTECTED]> To: Sent: Tuesday, April 10, 2007 4:37 PM Subject: Re: [PHP] Dates and different time zones Satyam wrote: Store all of your dates as GMT. Perform all date based calculations around GMT also, and then o

Re: [PHP] Dates and different time zones

2007-04-10 Thread Lester Caine
Satyam wrote: Store all of your dates as GMT. Perform all date based calculations around GMT also, and then offset the values for localised display only. This way you only need to store the GMT offsets for each user, i.e. GMT+1 or GMT-8 when it comes to displaying the dates to them. The trick

Re: [PHP] Dates and different time zones

2007-04-10 Thread Satyam
- Original Message - From: "Richard Davey" <[EMAIL PROTECTED]> To: Sent: Tuesday, April 10, 2007 3:43 PM Subject: Re: [PHP] Dates and different time zones Niklas Karlsson wrote: I am creating an international site that is going to get used in both American a

Re: [PHP] Dates and different time zones

2007-04-10 Thread Richard Davey
Niklas Karlsson wrote: I am creating an international site that is going to get used in both American and Europe. And I wonder how to handle the different time zones, because I want the date and time to be correct after the place your using the application. I now have the date_default_timezone_

RE: [PHP] Dates and different time zones

2007-04-10 Thread Jay Blanchard
[snip] So a wonder who to handle different time zones? Have any of your experience of this? [/snip] The server lives in one time zone and therefore cannot handle multiples unless there is some new widget available for this. There are a couple of methods available; 1. Use JavaScript to capture 'lo

Re: [PHP] Dates before 1970

2006-04-17 Thread tedd
At 6:43 PM -0500 4/17/06, Richard Lynch wrote: Call me crazy, but I think that: $time = 0x; //largest INT possible echo date('m/d/Y h:i:s a', $time); would be very revealing. H. Is: 12/31/1969 06:59:59 pm Yes, it is -- I remember what I was doing then. It was six months after I

Re: [PHP] Dates before 1970

2006-04-17 Thread Richard Lynch
Call me crazy, but I think that: $time = 0x; //largest INT possible echo date('m/d/Y h:i:s a', $time); would be very revealing. On Thu, April 13, 2006 10:26 pm, Suhas wrote: > This will definitely solve one way but still other is there, > How to get that -ve number which starts at 1/1/19

Re: [PHP] Dates before 1970

2006-04-13 Thread chris smith
> I have a project that deals with the date time stamps since 1900 (and > past), any suggestions about a good class that handles Date Time > Format before 1970. I really like date() function and want something > similar. If you're using a database at all, most of them will handle any sort of dates

Re: [PHP] Dates before 1970

2006-04-13 Thread Suhas
This will definitely solve one way but still other is there, How to get that -ve number which starts at 1/1/1900 at 00:00 AM = 0 I need to be able to convert back and forth as there are some calculations to be done on date field, But this is very interesting.. Thx SP On 4/13/06, Rasmus Lerdorf <

Re: [PHP] Dates before 1970

2006-04-13 Thread Rasmus Lerdorf
Suhas wrote: Hello, I have a project that deals with the date time stamps since 1900 (and past), any suggestions about a good class that handles Date Time Format before 1970. I really like date() function and want something similar. date() uses Unix timestamps which on most Unix platforms goes

Re: [PHP] Dates problem

2005-04-27 Thread Mario de Frutos Dieguez
Petar Nedyalkov escribió: On Wednesday 27 April 2005 09:17, Mario de Frutos Dieguez wrote: Hi! I have a problem with dates. I have a function that sum a duration in laboral days to an initial date. The problem come when the function reaches the last sunday of October, the data remains in the las

Re: [PHP] Dates problem

2005-04-26 Thread Petar Nedyalkov
On Wednesday 27 April 2005 09:17, Mario de Frutos Dieguez wrote: > Hi! > > I have a problem with dates. I have a function that sum a duration in > laboral days to an initial date. The problem come when the function > reaches the last sunday of October, the data remains in the last sunday > of Octob

Re: [PHP] Dates < then 1970

2003-11-03 Thread John W. Holmes
Mark McCulligh wrote: What function(s) would you use if you want to take someone's birth day and format it on display. I have always used strtotime, then strftime but it doesn't work if someone was born in 1939. strtotime returns -1. What function would you use to take the input string "1939/11/23

Re: [PHP] Dates

2003-10-03 Thread Kris Yates
Also, an option is to have that SQL field set as date. With postgres, I can insert 09-12-1967 and the sql server auto converts it to 1967-09-12 upon saving into date field. However, another way is.. Jay Blanchard wrote: [snip] Ok, Mayve I need to be a little clear, I under the link below as

RE: [PHP] Dates

2003-10-03 Thread Jay Blanchard
[snip] Ok, Mayve I need to be a little clear, I under the link below as showing dates. What I need to know how can I take the input of 09-12-1967 and have enter into a mysql data using php as 1967-09-12? Because everything that is past from my form to mysql is not the way it was enter. Would I

Re: [PHP] Dates

2003-10-03 Thread Payne
Ok, Mayve I need to be a little clear, I under the link below as showing dates. What I need to know how can I take the input of 09-12-1967 and have enter into a mysql data using php as 1967-09-12? Because everything that is past from my form to mysql is not the way it was enter. Would I need t

Re: [PHP] Dates

2003-10-02 Thread J Morton
date("Y-m-d", strtotime($your_date)) Payne wrote: > Hi , > > This might be mysql question but how can I change a US format date > (mm/dd/) to a MySQL Format (/mm/dd). Can I do this will php or > will need let say javascript or perl to do this? > > Payne > > -- > PHP General Mailing List

RE: [PHP] Dates

2003-10-02 Thread Jay Blanchard
[snip] This might be mysql question but how can I change a US format date (mm/dd/) to a MySQL Format (/mm/dd). Can I do this will php or will need let say javascript or perl to do this? [/snip] date("y/m/d"); RTFM at http://www.php.net/date -- PHP General Mailing List (http://www.php.

Re: [PHP] dates greater than 2002-01-18 create error

2002-08-12 Thread Danny Shepherd
sage - From: "John Wards" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, August 12, 2002 5:32 PM Subject: Re: [PHP] dates greater than 2002-01-18 create error > right am i missing something or is that not just an other Y2K "bug" waiting > to hap

Re: [PHP] dates greater than 2002-01-18 create error

2002-08-12 Thread John Wards
EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, August 12, 2002 5:26 PM Subject: RE: [PHP] dates greater than 2002-01-18 create error > Dude, did you read the PHP Date manual page? > > I quote: > > Note: The valid range of a timestamp is typically from Fri, 13 Dec 1

RE: [PHP] dates greater than 2002-01-18 create error

2002-08-12 Thread Adam Voigt
Dude, did you read the PHP Date manual page? I quote: Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). On windows this range

RE: [PHP] dates greater than 2002-01-18 create error

2002-08-12 Thread Jay Blanchard
[snip] [/snip] I take out '+1' and the result is 1969-12-31 I put in the '+1' and the result is 1970-01-01 I change '2038-01-19' to '2002-01-19' and it works. Which is what the subject of your message was, not [PHP] dates greater than 2038-01-18 create error HTH! Jay -- PHP General Maili

RE: [PHP] dates greater than 2002-01-18 create error

2002-08-12 Thread Jay Blanchard
[snip] Anytime I try to add a day to the date 2002-01-18, I get a Warning: unexpected error in date() error. Can anyone shed some light on this. [/snip] If you'll shed some code on this, we'll shed some help :^] Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http

Re: [PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane
inal 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()

2002-07-29 Thread Christopher J. Crane
; 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

Re: [PHP] Dates and Date()

2002-07-29 Thread 1LT John W. Holmes
r 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 w

Re: [PHP] Dates and Date()

2002-07-29 Thread Andrey Hristov
e 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]>

Re: [PHP] Dates and Date()

2002-07-29 Thread Andrey Hristov
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 PR

Re: [PHP] Dates and Date()

2002-07-29 Thread 1LT John W. Holmes
> 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 any

Re: [PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane
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

Re: [PHP] Dates and Date()

2002-07-29 Thread Andrey Hristov
nter-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()

Re: [PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane
ECTED]> 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:

Re: [PHP] Dates and Date()

2002-07-29 Thread Andrey Hristov
- 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"));

Re: [PHP] Dates and Date()

2002-07-29 Thread Analysis & Solutions
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

Re: [PHP] Dates and Date()

2002-07-29 Thread Rasmus Lerdorf
$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

Re: [PHP] Dates

2002-05-28 Thread 1LT John W. Holmes
PHP way: Use strtotime() to get a unix timestamp for each one. subtract smaller from larger and divide by number of seconds in a day. MySQL way: I assume these dates come from a database. Use a query like this: SELECT TO_DAYS(column_one) - TO_DAYS(column_two) AS Difference FROM table WHERE ...

RE: [PHP] Dates

2002-05-28 Thread Jared Boelens
Something like this.. $start = "2002-10-9"; $end = "2002-11-16"; $arStart = explode("-", $start); $arEnd = explode("-", $end); $startTime = date("U", mktime(0,0,0,$arStart[1], $arStart[2], $arStart[0])); $endTime = date("U", mktime(0,0,0,$arEnd[1], $arEnd[2], $arEnd[0])); $dif = $endTime - $start

Re: [PHP] Dates

2002-05-28 Thread Miguel Cruz
On Tue, 28 May 2002, Jeroen Timmers wrote: > 2002-10-9 and 2002-11-16 > > Is there a function to see how many day's between thore date's is? (strtotime($date1) - strtotime($date2)) / 86400 miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/un

RE: [PHP] dates only in the future

2001-09-25 Thread Boget, Chris
> I'm looking for a function which enables me to allow user > only to enter those dates which are still to come. In my head > I have three things... one for day, one for month and > one for year. In order to prevent the user from submitting the > form with the date which is in past, I need pr

RE: [PHP] dates

2001-04-16 Thread Maxim Maletsky
Why don't you look into mYSQL documentation and rewrite your queries, you might be able to end up with one only single query and 3 lines of PHP, instead of the whole bunch as you're trying to do. The reason I advise you that is that mySQL plays some really sweet games with dates, while PHP treat

Re: [PHP] dates

2001-04-16 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Alvin Tan") wrote: > a little stuck here. trying to pull a bunch of unix timestamps out and show > only those that show up today. problem is that when i hit the first match, > the rest of the dates don't show. code follows: > > ===

RE: [PHP] dates from db

2001-03-07 Thread Eric Naujock
My own solution to this is a bit more complex but it seems to work with both of the databases I work with. MySQL and Postgress. for example I would use 'select *,unix_timestamp(cr_date) as my_cr_date from table where ref_index=2345;' Then when I go to output it I can use the unix date command

RE: [PHP] dates from db

2001-03-07 Thread Mark Roedel
> -Original Message- > From: Matt Davis [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 07, 2001 7:35 AM > To: Php Mailing List > Subject: [PHP] dates from db > > > I am calling on a number of fields from my db one of which is > a date. When the date displays it is in the following

RE: [PHP] dates from db

2001-03-07 Thread Jon Haworth
If it's stored as a unix timestamp you can format it any way you like. [www.php.net/date] If it's stored as a string in the -MM-DD hh:mm:ss format, you can use substr(0,10) [www.php.net/substr] to get the first 10 characters and only display those. HTH Jon -Original Message- From:

Re: [PHP] dates

2001-02-18 Thread eschmid+sic
On Sun, Feb 18, 2001 at 06:54:02PM -0700, Julian Rockey wrote: > Yes I had a look at mktime() and date() and tried to think of an easy > way to do it but couldn't... you can convert both dates to a UNIX > timestamp (millseconds after whatever date) then do a subtraction... and > then what? Easy

Re: [PHP] dates

2001-02-18 Thread Julian Rockey
Yes I had a look at mktime() and date() and tried to think of an easy way to do it but couldn't... you can convert both dates to a UNIX timestamp (millseconds after whatever date) then do a subtraction... and then what? Easy to work out number of days from millseconds as a day's length is fixe

Re: [PHP] dates

2001-02-18 Thread eschmid+sic
On Sun, Feb 18, 2001 at 04:40:08PM -0700, Julian Rockeu wrote: > Anyone know how to use the PHP date functions to work out the difference > between two timestamps? > > For example.. > > Figure out the number of seconds, minutes, hours, days, months and years > between > > 5th October 2001 14: