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
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 get records
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?
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;
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
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
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
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 it to a timestamp
Hello,
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_set() to
[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
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
- Original Message -
From: Richard Davey [EMAIL PROTECTED]
To: php-general@lists.php.net
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
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
- Original Message -
From: Lester Caine [EMAIL PROTECTED]
To: php-general@lists.php.net
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
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
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
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
- Original Message -
From: Niklas Karlsson [EMAIL PROTECTED]
To: php-general@lists.php.net
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
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: php-general@lists.php.net
Sent: Tuesday, April 10, 2007 6:29 PM
Subject: Re: [PHP] Dates and different time zones
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,
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 storing
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
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
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.
Thanks in advance!
SP
--
PHP General Mailing List (http://www.php.net/)
To
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
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
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.
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 October and make an infinite loop. The functions works fine i have
test in
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 October
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
Hi everybody,
How do you save the date and time in the database? Time stamp or date
and time? GMT timezone or the server timezone, or maybe the configs
timezone? And when displaying apply user timezone to the GMT date?
I think it's easier to save in timestamp format, so it's easy to
convert to
Hi all,
I'm looking for a clear, dependable way to work with dates in a web
application.
There are two types of dates that I can see I'll need:
a) a timestamp for 'now' generated by the server (eg used on a last
updated field)
b) a timestamp for a user-specified date, like 2003-11-28 13:45:59
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 and get
the
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
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
[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
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..
?
$date=09-12-1967;
$dARR=explode(-, $date);
$tmon=$dARR[0]; $tday=$dARR[1]; $tyr=$dARR[2];
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 (http://www.php.net/)
To unsubscribe, visit:
[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
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
[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:
-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 Mailing List (http://www.php.net/)
To unsubscribe, visit: http
was, not [PHP] dates greater than 2038-01-18 create
error
HTH!
Jay
--
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
, 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 1901
20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates
: 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 happen?
Not that I plan to be coding php in 2038 but my kids might
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
$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
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
- 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
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
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
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
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,
: 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
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
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
[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
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
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:
; // in seconds
That will do it but you could simplfy it with some more advanced techniques.
-Jared
-Original Message-
From: Jeroen Timmers [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 2:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Dates
i have two dates
for example
2002-10-9
...
Then you'll have a column 'Difference' in your result that contains the
difference between the two dates in days.
---John Holmes...
- Original Message -
From: Jeroen Timmers [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 2:16 PM
Subject: [PHP] Dates
i have two
Hi all,
Is it possible to get dates in different languages
i.e. date (j F) would usually return, in the case, 13 April can I make it
display the date in French for example??
Thanks
Declan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Use strtotime().
$result = mysql_query(SELECT datefield FROM mytable);
$row = mysql_fetch_array($result);
$datevar=strtotime($row['datefield']);
echo date('m-d-Y', $datevar);
Regards,
David Johansen [EMAIL PROTECTED] wrote:
I was just wondering if there's any way to work with dates returned
I was just wondering if there's any way to work with dates returned from a
MySQL query in PHP. Right now I do all of different stuff in my MySQL query
but it's really cumbersome, so I would like to be able to do it all with
PHP. Is there any way to do that? Thanks,
Dave
Here's my MySQL query:
On Sunday 31 March 2002 04:04, David Johansen wrote:
I was just wondering if there's any way to work with dates returned from a
MySQL query in PHP. Right now I do all of different stuff in my MySQL query
but it's really cumbersome, so I would like to be able to do it all with
PHP. Is there
Good afternoon,
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 select
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'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 select 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
I'm having a prowith determing a time interval. I need to find out how many
seconds, minutes, days have passed since a cpecific date (1.1.1980.), but when I
pass that dade to a time stamp , I get 1983.315529200. How am I suposed to
handle the year (1983.) o there is smething else ? I think the
hi all,
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:
==
$sql = "SELECT * FROM dates";
$result = mysql_query($sql) or
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:
To: Php-General
Subject: [PHP] dates
hi all,
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:
==
$sql = "SELECT * FROM
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 format
-MM-DD 00:00:00
I Want it to only display the date and not the time like this
-MM-DD
Is it possible to remove the time when calling on it from the db
can anyone
: Matt Davis [mailto:[EMAIL PROTECTED]]
Sent: 07 March 2001 13:35
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 format
-MM-DD 00:00:00
I Want it to only display the date
-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 format
don;t have to count on your database
supporting it.
"Mark Roedel" [EMAIL PROTECTED] 03/07/01 09:08AM
-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 n
This is a function I use:
function DateDiff ($Date1, $Date2, $Period) {
/* expects dates in the format d/m/y - period can be one of 'd','w','y','m'
months are assumed to be 30 days and years 365.25 days This only works
provided that both dates are after 1970. Also only works for dates up to
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:20:10
and
26th February 1998 109:54:10
Help much appreciated!
thanks
Julian
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:20:10
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
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 to
80 matches
Mail list logo