×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How convert my date?

How convert my date?

How convert my date?

(OP)
I am using MS-SQL SERVER 2000, VB6, CR8
a field is datetime and "01.05.2001 00:00:00"
and this field is as group
I am to view this field "01 May 2001 Tuesday"

How ?

Thanks.

RE: How convert my date?

The basic formula is like this:


Date(
Val({field} [ 7 to 10 ] ),
Val({field} [ 4 to 5  ] ),
Val({field} [ 1 to 2  ] ) )


You can then format this date field however you like.  You might need to do some error checking to make sure that dates aren't blank or don't have invalid values.

Ken Hamady
http://www.kenhamady.com/
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)

RE: How convert my date?

If Crystal Reports recognizes the field as a datetime type field, then you can format this field to appear in wide variety of pre-existing formats, or create a custom format of your own.
If Crystal Reports recognizes the field as a string type field, then you could convert the string to a date, and then pick the format option you want for the date.  Normally this would just be DateValue({yourdatetimestringfield}), but since the "." character is not recognized as a valid date separator, you would need to replace the "." with "/".
DateValue( Replace({yourdatetimestringfield}, ".", "/") )
This method may be preferable, especially in situations where the datetime string varies in length, or you expect to encounter blank (empty string) values.

Malcolm

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close