Convert to Date
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 106
- Joined: Thu Jul 27, 2006 10:05 pm
- Location: Mumbai
Convert to Date
Hi,
How to Convert YYYYMM to Start date for Month
EX: 201011 to 01/11/2010
Regards,
BRK
How to Convert YYYYMM to Start date for Month
EX: 201011 to 01/11/2010
Regards,
BRK
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Provide the correct format strings and use conversion functions such as DateToString() and StringToDate(). You will also need to concatenate the day number (01) to the incoming string.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yes,If output Datatype is "Date" then it requires additional formatting based on the Database Date format or Date format.
Suppose Date format is "dd-mmm-yyyy" then derivation is as follows.
StringToDate("01/":DateToString(StringToDate('201011',"%yyyy%mm"),"%mm/%yyyy"),"%dd-%mmm-%yyyy")
Suppose Date format is "dd-mmm-yyyy" then derivation is as follows.
StringToDate("01/":DateToString(StringToDate('201011',"%yyyy%mm"),"%mm/%yyyy"),"%dd-%mmm-%yyyy")
Cheers
Ravi K
Ravi K
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Please think this through a bit more carefully.
The inner dates use "/" delimiter, but you specified "-" in the outer StringToDate() function. This won't work!Ravi.K wrote:StringToDate("01/":DateToString(StringToDate('201011',"%yyyy%mm"),"%mm/%yyyy"),"%dd-%mmm-%yyyy")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: