Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 2nd, 2005, 10:52 AM
frrobert frrobert is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 38 frrobert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 52 m 45 sec
Reputation Power: 4
Cast date to string

I am pulling dates into an asp.net web page datagrid and c# coverts the date to date + 12:00 AM and I thought the easiest way to fix the problem was to cast the date to a string.
so in my view I have
CAST(TBL_INCIDENT.REPORT_DATE AS VARCHAR(10)),

works ok but the answer comes out in yyyy-mm-dd I would like the format in mm-dd-yyyy or mm/dd/yyyy either one would be fine.


Any ideas?


Thanks

Fr. Robert

Reply With Quote
  #2  
Old May 3rd, 2005, 03:38 PM
frrobert frrobert is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 38 frrobert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 52 m 45 sec
Reputation Power: 4
The answer is

Code:
EXTRACT(MONTH FROM TBL_INCIDENT.REPORT_DATE)||'-' || EXTRACT(DAY FROM TBL_INCIDENT.REPORT_DATE)||'-' || EXTRACT(YEAR FROM TBL_INCIDENT.REPORT_DATE) ,
        EXTRACT(MONTH FROM TBL_INCIDENT.INCIDENT_DATE)||'-' || EXTRACT(DAY FROM TBL_INCIDENT.INCIDENT_DATE)||'-' || EXTRACT(YEAR FROM TBL_INCIDENT.INCIDENT_DATE) ,


Thanks

Fr. Robert
Comments on this post
pabloj agrees: Good job, thanks for sharing you solution with others
takoyaki agrees: thanks! you solved my problem too!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Cast date to string


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT