469,616 Members | 1,652 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,616 developers. It's quick & easy.

Using a text box disply date and time.

23
We are trying to get the following script to display the full date and time. The field we are calling does have both date and time in. Unfortunatly its only returning the date.

So I tried putting the sql "to_date('Adate','dd/mm/yyyy hh24:mi')" to disply the full field. No Luck

Any help is much appresiated. Thanks.[php]<HTML>
<HEAD><TITLE> Property Results </TITLE>
</HEAD>
<BODY>
<?php
$sql="Select * from Appointment where Appointment_id = ".$_GET["Appointment_id"];
putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin");
$conn = OCILogon("Username","Password","shu10g");
$stmt = ociparse($conn,$sql);
ociexecute($stmt);
ocifetchinto($stmt,$row);
ocifreestatement($stmt);
ocilogoff($conn);
?>
<form name="form1"method="post" action="appointmenthandler.php">
<input name="Appointment_id" type=hiddenid="Appointment_id" value='<?php print $row[0];?>'>

<table width="75%" border="1">
<tr>
<td><strong>Appointment ID</strong></td>
<td><?php print $row[0];?></td>
</tr>
<tr>
<td><strong><strong>Staff ID
</stong>
</strong></td>
<td><input name="Staff_id" type="text" id="Staff_id" value='<?php print $row[1];?>'></td>
</tr>
<tr>
<td><strong><strong>Tenant ID
</string>
</strong></td>
<td><input name="Tenant_id" type="text" id="Tenant_id" value='<?php print $row[2];?>'></td>
</tr>
<tr>
<td><strong>Property ID</strong></td>
<td><input name="Property_id" type="text" id="Property_id" value='<?php print $row[3];?>'></td>
</tr>
<tr>
<td><strong>Description</strong></td>
<td><input name="Description" type="text" id="Description" value='<?php print $row[4];?>'></td>
</tr>
<tr>
<td><strong>Appointment Date</strong></td>
<td><input name="Adate" type="text" id="Adate" value=
'<?php
$sql="Select to_date('Adate','dd/mm/yyyy hh24:mi') from Appointment where Appointment_id = ".$_GET["Appointment_id"];
putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin");
$conn = OCILogon("Username","Password","shu10g");
$stmt = ociparse($conn,$sql);
ociexecute($stmt);
ocifetchinto($stmt,$row);
print $row[5];
ocifreestatement($stmt);
ocilogoff($conn);
?>'
</td>
</tr>
<tr>
<td><strong>Duration (Min)</strong></td>
<td><input name="Duration_Min" type="text" id="Duration_Min" value='<?php print $row[6];?>'></td>

</tr>
</table>
<p>
<input type="submit" name"Submit" value="Submit">
</p>
</form>
</BODY>
</HTML>[/php]
Apr 11 '08 #1
2 3536
ronverdonk
4,258 Expert 4TB
warning:

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Apr 11 '08 #2
Atli
5,058 Expert 4TB
Hi.

I'm not really good with Oracle, so I can't tell if there is a problem with the SQL.

But...You could always use the PHP date functions to format the date.

Try getting the actual timestamp from your database and use the date function to create your output.

If the database doesn't return a timestamp, try the strtotime function to convert it.
Apr 12 '08 #3

Post your reply

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

Similar topics

4 posts views Thread by Robert Scarborough | last post: by
5 posts views Thread by junglist | last post: by
1 post views Thread by vikraman | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.