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!

Dae format problem

Status
Not open for further replies.

tedi1

Technical User
Aug 25, 2002
87
IL
Hi,

I have a string DB filed which actually contains a datetime in the format of "mm/dd/yyyy hh:mi:ss". I’m trying to convert this string to datetime in crystal using cdatetime. the problem is that when the date is being displayed when there is a date such as 17/8/2003 it's being displayed in the format of dd/mm/yyyy (as it should be), but when the date is 7/8/2003 (august is the month) the CR displays it as 8/7/2003. how can I keep the format of "dd/mm/yyyy hh:mi:ss". I have tried using cdatetime(picture ({RAW_UDR.MRKT_PARAM3}, "mm/dd/yyyy hh:mi:ss")) But I'm getting a bad date format Err.
I'm useing CR 9 on Win 2k server
 
To return a datetime, try using the following:

cdatetime({RAW_UDR.MRKT_PARAM3})

Then right click on the field->format field->date/time->customize->date->order->DMY. This will give you the day first and maintain the datetime data type.

If you were trying to format to a string using totext, you would do it like this:

totext(datetime({RAW_UDR.MRKT_PARAM3}),"dd/MM/yyyy hh:mm:ss")

Note the letters used for formatting. The picture function (which also is based on and returns a string) would not help you change the order of the day and month. It uses a mask like "xxxxxxxxxx xxxxxx", not letters identifying date parts.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top