473,792 Members | 2,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Time/Date Stamp for csv.php file

6 New Member
I have a registration form that loads into a dava.csv file (code below). I want to add a time/date stamp so that each time someone registers, the last column in the spreadsheet shows the time/date. I've tried several things but all have failed and the form stops working. I'm taking classes this fall on programming but need to do this now, unfortunately. Any help? :confused:

[PHP] <?php
@extract($ POST);
if(is_writable( 'data.csv'))
{
$fp = fopen('data.csv ','a');
$content = "\"$fRSVP\",\"$ fRepName\",\"$f RepTitle\",\"$f Lunch\",\"$fPre fix\",\"$fFirst Name\",\"$fLast Name\",\"$fTitl e\",\"$fCompany \",\"$fAddress\ ",\"$fCity\",\" $fProvince\",\" $fPostalCode\", \"$fTelephone\" ,\"$fFax\",\"$f Email\r\n"
fwrite($fp,$con tent);
fclose($fp);
header("Locatio n: return URL");
}
else
{
echo'File is not writable';
}
?>
[/PHP]
Aug 3 '06 #1
8 4557
ronverdonk
4,258 Recognized Expert Specialist
Do you mean like:

Expand|Select|Wrap|Line Numbers
  1. $DateTime = strftime("%d/%m/%Y %H:%M:%S", time());
(gives you e.g. 04/08/2006 00:13:15) and then adding $DateTime to your string?

Ronald :cool:
Aug 3 '06 #2
Banfa
9,065 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. $DateTime = strftime("%d/%m/%Y %H:%M:%S", time());
You don't need that call to time, if you leave it out PHP assumes NOW

Expand|Select|Wrap|Line Numbers
  1. $DateTime = strftime("%d/%m/%Y %H:%M:%S");
I was going to suggest

Expand|Select|Wrap|Line Numbers
  1. $DateTime = Date("%c");
Aug 4 '06 #3
bessie
6 New Member
Where do I place the date stamp? Yesterday I tried putting it after email and before the /r/n but caused the form to stop working. I want the date stamp to appear at the end of each row (each row contains one registrant).

Thanks!
Aug 4 '06 #4
bessie
6 New Member
This almost worked - the form functioned but I got a () as a result - at least I'm closer.

\",$today()\r\n ";
Aug 4 '06 #5
ronverdonk
4,258 Recognized Expert Specialist
If $today is your string holding the date/time-stamp, you don't specify the parentheses, just $today

Ronald :cool:
Aug 4 '06 #6
bessie
6 New Member
",\"$datetime=n ow()\",\r\n";

This is now working but gives me the info in seconds. However, I can use Excel to translate for the date. Still don't know how to get both the date & time except to repeat the code and use Excel for time translation for the second entry. I suspect there is a better way.
Aug 4 '06 #7
bessie
6 New Member
Just figured out that the code works perfectly for time/date just by choosing the right cell formatting in Excel. YIPEEEEEEEEF! TTFN.
Aug 4 '06 #8
ronverdonk
4,258 Recognized Expert Specialist
Well, Good Luck!

Ronald :cool:
Aug 4 '06 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

7
19634
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance, Don Following running on client-side:
3
2089
by: Des | last post by:
I am trying to write a date and time stamp to a file Date("d-m-y") is ok but time(void) gives me 1124528448 Can I format time into a H:M:S format Desmond.
6
13595
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital dot org
3
17614
by: phried1 | last post by:
I have created a form and inserted the following tables: Date Entered Time Entered Date Modified Time Modified Essentially how and where can I have these dates and times recorded so when the user creates a new record that date and time stamp is populating as well as if the user modifies the data, that date and time stamp is populationg. Whereby if the record was created yesterday, and the user modified the record today, i would see...
1
7298
by: Susan Bricker | last post by:
Greetings. I have a report (actually all of my reports in an MDB) that I want to date/time stamp at the bottom. Previously, I had used the builtin function of Now(). I thought that would give me a date and time value in the format: "month day, year hour:minutes:seconds". However, I noticed that only the date was printing (e.g.; January 23, 2006). This is in Access 2000. BTW ... The way I display the date/time stamp in a text field...
9
2100
by: pob | last post by:
I currently have a procedure that loops thru a recordset to determine what files need to be loaded to my database. The naming convention of the files has always been accounts.txt, namelist.txt, etc. Within the procedure I also validate that the file loaded to the server was loaded within the current day. Everything has run smooth for quite some time using this method. Now the vendor has told me he has choice, but to the send the file...
4
6810
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form allows the employee to enter their UserID and select "Login" or "Logout" and then click a submit. When the submit button is clicked, I want the application to dum the NT Userename, UserID, status (Login or Logout) and a date/time stamp into an MS Access...
2
1862
by: Shane | last post by:
I'm writing a program for renaming my picture files, and I want to use the picture time stamp as a prefix to the file names. I can get the time stamp, but it is extraordinarily slow! I have about 250 pictures in the directory. In debug mode, I can populate the names in a listview in less than two seconds. If I add a column with the time stamp as a string, the listview takes about 70 seconds to populate in debug mode. I haven't made and...
6
9555
by: trytobreak | last post by:
Hi All, I am a network administrator in a fairly large software company and I would like to write myself a small utility, which would connect (one by one) to all machines on the network and get their current date and time stamps. This is mostly because of coming DST changes and having hundreds of machines on the network, I don't want to connect remotely to every and each server to see if the time is correct.
1
2090
by: 6afraidbecause789 | last post by:
Hi - I am using a Date/Time Picker popup form for users to choose a a date and time for use on a separate entry form. The date/time on the entry form is actually entered automatically as a date/time stamp when a user enters a record. So, the popup form is only necessary when a user needs to change the date/time. To make this more user-friendly...there will be times when a user will be away from the computer, and therefore, will have to...
0
9670
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10430
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.