PDA

View Full Version : date changes


garoboldy
08-09-2004, 03:31 PM
I have this problem:

pulling a date from sql in this format 2004-04-12 0000:00:00

I trim it down to just the date and display as needed.

what I want to do is pull my latest information for past 5 days meaning as I run my query its going to get the date in the row change it to 2004-04-12 format without the time and see if its todays date or a date up to 5 days ago if it is then I want that information, if not then I dont.

this is going to be for a quick way to see my recent serice calls and what not that I use here at work.

if anyone has any ideas let me know, also if you need some code to see what exactly I have going on I will post on request.

Thanks

Colin F
08-09-2004, 03:37 PM
I have this problem:

pulling a date from sql in this format 2004-04-12 0000:00:00

I trim it down to just the date and display as needed.

what I want to do is pull my latest information for past 5 days meaning as I run my query its going to get the date in the row change it to 2004-04-12 format without the time and see if its todays date or a date up to 5 days ago if it is then I want that information, if not then I dont.

this is going to be for a quick way to see my recent serice calls and what not that I use here at work.

if anyone has any ideas let me know, also if you need some code to see what exactly I have going on I will post on request.

Thanks
That might be a bit hard, as you're saving it as a string (I assume) meaning you can't order it by number...

Dean C
08-09-2004, 03:51 PM
Well why anyone would store date/time in that format within a database is beyond me. The best thing to do would be to add a new column to that table. And make a script to change all the dates into a timestamp. Then it's much more easy to work with :)

garoboldy
08-20-2004, 03:36 PM
yeah I got it fixed with the sbstr command and cut the string up the way I wanted it.