converting a string to Date
Moderators: chulett, rschirm, roy
converting a string to Date
Hi,
Is there any way to convert a string (dd-mm-yyyy) to date format. I think it is possible to convert a string which is in the format 'yyyy-mm-dd' to date easily using type conversion functions, but i need to convert the above string which is in the format 'dd-mm-yyyy' to date.
For ex: '23-06-1999' (datatype: String ) ===> '1999-06-23' (datatype: Date)
Is there any way to handle this? I wrote a routine to do that, but the thing is it is taking much time to process the records. Using stage variables also i tried handling it by splitting and concatenating the separated bits, even that one proved to be not an optimised solution.
Can you please through light on this.
thanks,
Bhasan.
Is there any way to convert a string (dd-mm-yyyy) to date format. I think it is possible to convert a string which is in the format 'yyyy-mm-dd' to date easily using type conversion functions, but i need to convert the above string which is in the format 'dd-mm-yyyy' to date.
For ex: '23-06-1999' (datatype: String ) ===> '1999-06-23' (datatype: Date)
Is there any way to handle this? I wrote a routine to do that, but the thing is it is taking much time to process the records. Using stage variables also i tried handling it by splitting and concatenating the separated bits, even that one proved to be not an optimised solution.
Can you please through light on this.
thanks,
Bhasan.
-
- Premium Member
- Posts: 151
- Joined: Fri Feb 13, 2009 4:19 pm
Hopefully, what you meant to type was:
Also be mindful of the century pivot when you use two-digit years.
Code: Select all
StringToDate(Column_name,'%dd-%mmm-%yy')
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers