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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string:"yyyymmdd" to date format: #dd/mm/yyyy#

Status
Not open for further replies.

luzippu

Programmer
Sep 2, 2003
24
GB
How can I transform a string "yyyymmdd" (ie: 20020131) to a date format #dd/mm/yyyy# (ie: 31/01/2002)?

I cannot use @StrReverse() or @DateValue()...

Thanks in advance for your help

luzippu
 
...continuing reading previous threads I found:

WhilePrintingRecords;
NumberVar input := {table.StartDate}; // or whatever your field name is
// This line checks for a minimum value, any value will work.
If input < 19590101 then Date (1959, 01, 01) else

Date ( Val (ToText (input, 0 , &quot;&quot;) [1 to 4]),
Val (ToText (input, 0 , &quot;&quot;) [5 to 6]),
Val (ToText (input, 0 , &quot;&quot;) [7 to 8]) )

thanks to
it now works correctly
 
Your welcome

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top