Page 1 of 1

Does anyone know how to make a linux time stamp?

Posted: Tue Dec 30, 2003 11:00 pm
by genetix
I currently own an site and I need to insert data into a mysql database every once and a while. The problem is I dont know how to write a time stamp. I'm going to be using control pannel 8 I think it is so I need to know what to put into the boxes.

Can anyone help me out?

Posted: Wed Dec 31, 2003 3:54 am
by toms100

Code: Select all

<?php
echo time();
?>

Posted: Wed Dec 31, 2003 4:41 am
by Weirdan
keep in mind that mysql timestamps aren't unix timestamps. If you are going to insert that timestamp into timestamp field it should be formatted as

Code: Select all

echo date("YmdHis");

Posted: Wed Dec 31, 2003 8:35 am
by devork
unix timestamp just gives you overall one figure
131234123123 from jan1 1970

but mysql as said above gives like this
20031231173510
year month day hour minute second

Posted: Wed Dec 31, 2003 3:01 pm
by Pyrite
Correct. Unix Timestamp is the number of seconds since the Unix Epoch (01/01/1970).

Posted: Wed Dec 31, 2003 7:43 pm
by genetix
I'm just wondering about the command input box. i noticed in all the control pannels I looked at they give you a very small space to type in commands. How would you write a command? Is it written like a normal webpage?

Posted: Wed Dec 31, 2003 8:40 pm
by m3rajk
have you ever done shell scripting?


webpages are markup languages. the scripting langs used are often just tools for displaying dynamic markup in regaurds to the web. if you haven't done shell scripting i STRONGLY suggest getting a tutorial on that beforeyou write a control panel/interface for linux.

Posted: Thu Jan 01, 2004 4:55 am
by Pyrite
I have/use cpanel 8, and I really don't know what you're talking about. But it might be in the cpanel docs?

http://www.cpanel.net/docs.htm

Posted: Thu Jan 01, 2004 9:35 am
by m3mn0n
Hey I know you!

*waves*

Posted: Fri Jan 02, 2004 5:07 pm
by genetix
I dont want to write a control pannel.

If you go into the cron job section of control pannel 8 you can type in the date you want a script to run and then you write in the script or command you want it to run when the time is reached.

Heres the demo:
http://cpaneldemo.cpanel.net:2082/front ... ecron.html?

I just need to know what to put in the command field. Can I put normal php?

Posted: Fri Jan 02, 2004 11:43 pm
by Pyrite
So really your question is how do I use cron jobs then. Why not google some info about cronjob syntax. Cause this has nothing to do with cpanel or php.

Posted: Wed Jan 07, 2004 8:22 am
by genetix
I know how to set when it works and that but I'm using CPannel 8 on a Unix server and I was wondering if I could use php in the command line?

Posted: Wed Jan 07, 2004 9:32 am
by Pyrite
I'm using cpanel 8 on a Unix server too, in fact cpanel is only starting to work on Windows. I'm sorry though, you're questions keep changing and your english is too poor. I don't understand you. You can use php on the CLi if php is compiled as a CGI.

Posted: Wed Jan 07, 2004 12:22 pm
by genetix
my question is the same its just people keep interpretting it wrong. I will make the full question in this post:

When I log into my control pannel for my website(CPannel 8) and I got to cronjobs then hit standard it shows options that must be filled in. The first option is an email address to email the results to. The third one is selection boxes where you select the time when the script should run. The last one is the one I'm having trouble with. Its a box with the title Command: I am wondering it I can put php in the command box. I'm trying to insert mysql rows into a database through a cron job. a demo of control pannel 8 is available at http://www.cpanel.net/.

To jump right to the cron job demo go here:

http://cpaneldemo.cpanel.net:2082/front ... ecron.html? username cpdemo
password cpdemo

Posted: Wed Jan 07, 2004 6:34 pm
by Pyrite
AAH! Now that makes sense.

You can put php there if php is compiled as a CGI module on your server. If not, then no you can't. However you could call the mysql program to insert .sql files into databases. Probably easier that way anyway.