473,396 Members | 1,724 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.

generate mysql timestamp

how can I generate a mysql timstamp value of the current time?

sample:
20040605042505
YYYYMMDDhhmmss

is it only possible by concat year.month.day.hours.minutes.seconds or is
there any final function included in PHP to do that for me?
I didn't find it, yet.
I hope you can give me a hint?

thanks,
Lars
Jul 17 '05 #1
6 10383
In article <40***********************@newsread2.arcor-online.net>, Lars Plessmann wrote:
how can I generate a mysql timstamp value of the current time?


It's in the MySQL manual. Where it should be. Meaby you want to have a
look at the NOW function overthere too.

--
Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>
Jul 17 '05 #2
Tim Van Wassenhove wrote:
In article <40***********************@newsread2.arcor-online.net>, Lars Plessmann wrote:
how can I generate a mysql timstamp value of the current time?

It's in the MySQL manual. Where it should be. Meaby you want to have a
look at the NOW function overthere too.


No I need it in PHP to store it in an Object variable.
So I don't want to call a SELECT or any other mysqwl based function.
Jul 17 '05 #3
In article <40***********************@newsread2.arcor-online.net>, Lars Plessmann wrote:
Tim Van Wassenhove wrote:
In article <40***********************@newsread2.arcor-online.net>, Lars Plessmann wrote:
how can I generate a mysql timstamp value of the current time?

It's in the MySQL manual. Where it should be. Meaby you want to have a
look at the NOW function overthere too.


No I need it in PHP to store it in an Object variable.
So I don't want to call a SELECT or any other mysqwl based function.


I'd use a unix timestamp then. Both PHP and MySQL know how to handle it.

--
Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>
Jul 17 '05 #4
On 2004-06-05, Lars Plessmann <La************@gmx.de> wrote:
is it only possible by concat year.month.day.hours.minutes.seconds or is
there any final function included in PHP to do that for me?
I didn't find it, yet.


The hint would be `date' and `format string'.
date('YmdHis', $timestamp)

But you could also save the timestamp as int(11) in the table.

Bye,
phil
--
Please send replies (not followups) to the address set in Reply-To.
Philipp Kern - PK2186-RIPE - http://www.philkern.de
Jul 17 '05 #5
Tim Van Wassenhove wrote:
In article <40***********************@newsread2.arcor-online.net>, Lars Plessmann wrote:
Tim Van Wassenhove wrote:
In article <40***********************@newsread2.arcor-online.net>, Lars Plessmann wrote:
how can I generate a mysql timstamp value of the current time?
It's in the MySQL manual. Where it should be. Meaby you want to have a
look at the NOW function overthere too.


No I need it in PHP to store it in an Object variable.
So I don't want to call a SELECT or any other mysqwl based function.

I'd use a unix timestamp then. Both PHP and MySQL know how to handle it.


My question was if it is possible to generate a timestamp in the mysql
format. I did not ask how to handle it better.
There a several reasons why I have to do it in that way!

Well, do you know a function? Otherwise I will generate it manually.
thanks in advance,
Lars
Jul 17 '05 #6
Philipp Kern wrote:
On 2004-06-05, Lars Plessmann <La************@gmx.de> wrote:
is it only possible by concat year.month.day.hours.minutes.seconds or is
there any final function included in PHP to do that for me?
I didn't find it, yet.

The hint would be `date' and `format string'.
date('YmdHis', $timestamp)

But you could also save the timestamp as int(11) in the table.

Bye,
phil


well, okay :)
that was what I was searching for!

thanks, Philipp!
Jul 17 '05 #7

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

Similar topics

2
by: Ben | last post by:
I would like to use php to query a database and retrieve a unix timestamp. The problem is that mysql is storing the data in the date format and not a timestamp. I am sure that I can amend my...
3
by: @$operamail$.com | last post by:
I have been trying to use a MySQL database with PHP having a date/time field set to timestamp(14). It keeps being set to a string of all zeroes (00000000000000). This happens evn if I use a query...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
1
by: windandwaves | last post by:
Hi Folk Some of you may be interested in a function that allows you to add/substract from a date in PHP, using a MySql Dateformat (e.g. 2005-10-31) (NOT TESTED): Any comments appreciated. ...
1
by: gordon.dtr | last post by:
Hi, Has anyone had this problem ? I am using MySQL ODBC 3.51 Driver, with MS Access 2003 and MySQL 4.1.11 standard log. I created my tables in MS Access, then exported them via ODBC to an...
2
by: David | last post by:
Hi, Has anyone had this problem ? I am using MySQL ODBC 3.51 Driver, with MS Access 2003 and MySQL 4.1.11 standard log. I created my tables in MS Access, then exported them via ODBC to an...
2
by: Ted | last post by:
1) In several tables, in my MySQL version, I created columns using something like the following: `ab_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, This...
6
by: Brandon | last post by:
I'm using PHP with MySQL 4.x and was having trouble converting a datetime from MySQL into a formatted string until I ran across this solution that converts a YYYY-MM-DD HH:MM:SS string into a...
6
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might be
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.