Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Display Date from Datetime

Author  Topic 

cindy7
Starting Member

3 Posts

Posted - 2008-07-25 : 13:59:32
I have a date and time stamp in a Date/Time field of General Date format (2008-06-24 00:00:00.0)
I just want to result to display the Date without time and different format, exa:

from (2008-06-24 00:00:00.0) to (24-Jun-08)
This my select query:

<CFQUERY DATASOURCE = "#DSOURCE#" NAME = "result">
SELECT *
FROM tableA.reports
Where StartDate between '01-Jun-08' and '24-Jul-08'
ORDER BY ID
</CFQUERY>
when I did this select in Oracle SQL, I have no problem and display like this: '24-Jun-08'
But when I did this under cfm form and display like this: (2008-06-24 00:00:00.0)
I have been read and try many different way but no luck, please help me, I am stuck???????????

Thanks in advance!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-25 : 14:24:18
this is purely a display issue which you should handle at your front end. Please use formatting functions available at your front end application for this
Go to Top of Page

VGuyz
Posting Yak Master

121 Posts

Posted - 2008-07-28 : 09:19:23
Convert the date column like below

SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), ' ', '-') AS [DD-Mon-YY]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-28 : 10:26:49
quote:
Originally posted by VGuyz

Convert the date column like below

SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), ' ', '-') AS [DD-Mon-YY]


not recommended unless you dont have a real front where you can do the formatting.
Go to Top of Page

cindy7
Starting Member

3 Posts

Posted - 2008-07-29 : 09:36:03
Thank you for quick response,
I did try:
SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), ' ', '-') AS [DD-Mon-YY]
but still doesn't work, maybe I did not do it right.
Here is my code:
--------------------------------------------------------
<CFQUERY DATASOURCE = "#DSOURCE#" NAME = "result">
SELECT *
FROM tableA.reports
Where StartDate between '01-Jun-08' and '24-Jul-08'
ORDER BY ID
</CFQUERY>

<table border="1" width="1000" id="table1">
<tr><td><b>ID</b></td>
<td><b>Initiate Date</b></td>
</tr>
<tr><CFOUTPUT QUERY = "result">
<td>#ID#td>
<td>#INITIATE_DATE#td>
<form action="../result.cfm?From=Edit&ID=#ID#" method="post">
<input type="submit" value="Edit"></form>
</tr>

---------------------------------------------------------
here result:
ID | Initiate Date
478 | 2008-06-24 00:00:00.0

How do I need to format for displace the result without the time,
please help.
Thanks
Go to Top of Page

cindy7
Starting Member

3 Posts

Posted - 2008-07-29 : 10:09:30
I did found the solution for displacy format:
here the code:
from this <td>#INITIATE_DATE#td>
to <td>#DATEFORMAT(INITIATE_DATE, "m/dd/yyyy")#td>

Thanks for all your help.


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-29 : 11:36:29
quote:
Originally posted by cindy7

I did found the solution for displacy format:
here the code:
from this <td>#INITIATE_DATE#td>
to <td>#DATEFORMAT(INITIATE_DATE, "m/dd/yyyy")#td>

Thanks for all your help.





is this cold fusion?
Go to Top of Page
   

- Advertisement -