By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,264 Members | 1,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,264 IT Pros & Developers. It's quick & easy.

generate mysql timestamp

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.