473,396 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Date functions

Ok

This is really anoying me...

I am using a timestamp colum in my MySQL table, I generate a timestamp with
php using time(); When I pull the time from the table I get some date from
the 1970's... does anyone know whats going on? Im using the date() function
to display the timestamp.

Thanks
Jul 17 '05 #1
3 1967

On 19-Mar-2004, "Hayden Kirk" <sp**@spam.com> wrote:
I am using a timestamp colum in my MySQL table, I generate a timestamp
with
php using time(); When I pull the time from the table I get some date from
the 1970's... does anyone know whats going on? Im using the date()
function
to display the timestamp.


Without seeing your code I would guess that you are inserting the time()
directly into the timestamp column. This won't work because mysql is not
expecting a unix timestamp. Change the column type to int or insert a proper
mysql time.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2
Ah ok

That is the problem

What is the mysql time format? I thought it was a unix time stamp?

Could I get a breif example please...

I know this is a linux n00b question... but why do dates start at 1970?

Thanks

"Tom Thackrey" <us***********@nospam.com> wrote in message
news:J8*******************@newssvr29.news.prodigy. com...

On 19-Mar-2004, "Hayden Kirk" <sp**@spam.com> wrote:
I am using a timestamp colum in my MySQL table, I generate a timestamp
with
php using time(); When I pull the time from the table I get some date from the 1970's... does anyone know whats going on? Im using the date()
function
to display the timestamp.
Without seeing your code I would guess that you are inserting the time()
directly into the timestamp column. This won't work because mysql is not
expecting a unix timestamp. Change the column type to int or insert a

proper mysql time.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)

Jul 17 '05 #3


On 19-Mar-2004, "Hayden Kirk" <sp**@spam.com> wrote:
What is the mysql time format? I thought it was a unix time stamp?

The manual is your friend:
http://www.mysql.com/doc/en/Date_and_time_types.html

Could I get a breif example please...
'2004-03-19 12:00:00'

I know this is a linux n00b question... but why do dates start at 1970?


The Unix timestamp was the system time on the original Unix systems. There
was no need for dates prior to 1970, so it was defined as the number of
seconds since Jan 1, 1970.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ndsoumah | last post by:
Hi guys I'm having a hard time trying to validate some dates. I have a form that accept dates from users in this format (YYYY-mm-dd). I've been looking at the available datetime functions and...
8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: Noozer | last post by:
I have a textbox on one of my forms that is used to accept a time from the user. I need to write this value to a database to trigger an event later on. What I'd like to know is... Are there...
3
by: usenet | last post by:
I have inherited a table where date information was saved from PHP as a VARCHAR. (Sigh.) This means that the so-called date fields look like this : August 1, 2005, 9:09 am EDT October 13, 2004,...
4
by: Ekong, Samuel Akpan | last post by:
Hi, I am parsing a binary file and intend to read a date(not time) field encoded thus: 0xA1290B(little-endian). Now I know the date to be 12/04/2003 but just cannot get any of the known datetime...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
8
by: MLH | last post by:
Sometimes it works and sometimes it crashes. If I want "Today is " & Date$ & "." to appear in a query field, why might it work sometimes and not others? Would I be better to call a FN? Say,...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.