-
May 5th, 2004, 06:30 PM
#1
Member
storing system date in my sql
Hello guys, How i can store system date using mysql query
Code:
insert into table values('val1',system date here,'value2');
either I have to use now() function or else.
or
using default while creating table
Code:
create table abc('col1',system date here,'col2');
thanks.
-
May 5th, 2004, 06:30 PM
#2
Member
storing system date in my sql
Hello guys, How i can store system date using mysql query
Code:
insert into table values('val1',system date here,'value2');
either I have to use now() function or else.
or
using default while creating table
Code:
create table abc('col1',system date here,'col2');
thanks.
-
May 6th, 2004, 06:25 AM
#3
Here is a timestamp in php which is day-year-second (day of the year-year-seconds in the day)
Code:
$curtime = getdate();
$curTimeInSec = ((($curtime['hours'] * 60) * 60) + ($curtime['minutes'] * 60) + $curtime['seconds']);
//create a time stamp for database
$timearray = array($curtime['yday'], $curtime['year'], $curTimeInSec);
$dbtimestamp = implode("-", $timearray);
A mind full of questions has no room for answers 
-
May 6th, 2004, 06:25 AM
#4
Here is a timestamp in php which is day-year-second (day of the year-year-seconds in the day)
Code:
$curtime = getdate();
$curTimeInSec = ((($curtime['hours'] * 60) * 60) + ($curtime['minutes'] * 60) + $curtime['seconds']);
//create a time stamp for database
$timearray = array($curtime['yday'], $curtime['year'], $curTimeInSec);
$dbtimestamp = implode("-", $timearray);
A mind full of questions has no room for answers 
-
May 6th, 2004, 08:44 AM
#5
If you store the system date as an INT datatype, you can use the UNIX_TIMESTAMP() function of MySQL to get the number of seconds since the epoch.
-
May 6th, 2004, 08:44 AM
#6
If you store the system date as an INT datatype, you can use the UNIX_TIMESTAMP() function of MySQL to get the number of seconds since the epoch.
-
May 6th, 2004, 05:58 PM
#7
If you store it as a MySQL timestamp you can convert it to whatever you like with DATE_FORMAT, DATE_ADD, DATE_SUB, UNIX_TIMESTAMP or whatever in the query and hand most of the processing over to a binary application rather than a interpreted script...
The owl of Minerva spreads its wings only with the falling of dusk. -Hegel
-
May 6th, 2004, 05:58 PM
#8
If you store it as a MySQL timestamp you can convert it to whatever you like with DATE_FORMAT, DATE_ADD, DATE_SUB, UNIX_TIMESTAMP or whatever in the query and hand most of the processing over to a binary application rather than a interpreted script...
The owl of Minerva spreads its wings only with the falling of dusk. -Hegel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|