Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formatting question

Status
Not open for further replies.

jsteph

Technical User
Joined
Oct 24, 2002
Messages
2,562
Location
US
Hi all,
I'm aware that there is a Convert() function, which can be used for dates and takes an argument, ie, 101, 108, etc for specific formats of dates. My question is--Is there an easy way to custom format a date?

I'm thinking something similar to the vb Format() function, which can accept a custom string format argument.

For example, say today is 5/15/2008, I want to display just the format YYYYMM, ie, 200805.

How can I do that without a complex string-parsing function combined with some cast or convert function (keeping in mind the example format could be anything--I may also want 2008_05, or May 2008 or whatever).
Thanks,
--Jim
 
VB has nice formatting functions because that is where you should be formatting your dates. Think of it this way.... nobody actually see's the data in your database. The see the presentation of it in whatever front end application you are using.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Thanks all,
Yes, I do have front-end formatting available, and I understand the idea of the presentation layer.

However, my issue is that I'm preparing some views for which I want a certain amount of portability. The same view will be used for a Crystal report, an MS Access report, Excel, and HTML created within ASP. I'll be delivering raw data to the different users for any of these front ends and I want to minimize the customization.

I will look into building a custom function, it sounds like the way to go in this instance.
Thanks,
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top