Can anyone help me with a script to write the date. Im using php4 and am stuck.
I have a script that adds a series of numbers and outputs it to a new file.
What I want is the output to be saved (appended) to an existing file (total.txt) and instead of simply providing the number, to also include a date stamp. So each day the output would be something like - 2008-12-22;238794
Over a series of days, the resulting total.txt would look like:
2008-12-22;238794
2008-12-23;525355
2008-12-24;636633
2008-12-25;455747
write date in file - major help needed
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: write date in file - major help needed
Why are you using PHP4? 
Try sticking to standard MySQL DATETIME format and things will be easier.
To customize DATETIME output see http://php.net/date
Try sticking to standard MySQL DATETIME format and things will be easier.
Code: Select all
<?php
function user_date_mysql($date, $format) {return date ($format, strtotime($date));}
$the_date = '2008-12-18 13:47:21';
echo user_date_mysql($the_date, "l F jS, Y, h:iA");
?>