Hi all,
can any one direct me about changing the date format..
my input is like:
Thu Jan 19 16:59:51 EST 2006
but i need to output as like:
YYYY-MM-DD T 00:00:00 (format)
it will be done by using iconv or oconv functions.but i am not getting reqd.output
can any one help me with exact syntax
changing the dateformat
Moderators: chulett, rschirm, roy
changing the dateformat
Thanx&Regards
scorpion
scorpion
Iconv and Oconv won't work in Parallel Stages you need to use DatetoString function. Read the manual for more help on these functions. Or post what is your syntax.
Regards
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Re: need help on date format
hi,
Can you give us your exact requirement? Do you want your transformed data to be in string or Timestamp format?
If your input string is of the format you mentioned then you can use Stage variable and get convert "Jan" to 01(in string) and atlast concatenate all into the string you want
Regards
Om
Can you give us your exact requirement? Do you want your transformed data to be in string or Timestamp format?
If your input string is of the format you mentioned then you can use Stage variable and get convert "Jan" to 01(in string) and atlast concatenate all into the string you want
Regards
Om
scorpion wrote:hi all,
cau any one helpme on this?
tx
Hi
If your format "Thu Jan 19 16:59:51 EST 2006" is like this I don't think there is a function to convert. You have to break the day, month and year part based on your source format and then finally concatenate
If your format "Thu Jan 19 16:59:51 EST 2006" is like this I don't think there is a function to convert. You have to break the day, month and year part based on your source format and then finally concatenate
Regards
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
-
- Charter Member
- Posts: 166
- Joined: Wed Mar 16, 2005 6:52 am
- Location: Mumbai, India
Re: changing the dateformat
Hi Scorpion,scorpion wrote:Hi all,
Thu Jan 19 16:59:51 EST 2006
but i need to output as like:
YYYY-MM-DD T 00:00:00 (format)
it will be done by using iconv or oconv functions.but i am not getting reqd.output
can any one help me with exact syntax
Good news:
Like Rasi said, if the source is a string(char or varchar), you can get necessary substrings for the Date and Year directly from the Source.
Bad News:
I could not find any Pattern string that fits the Month part. The resolution would be 12 Nested If-then-else Statements in a stage variable that get the Month Number.
Finally the desired date format can be assembled from the pieces like:
SvYearPart<- <In.Date>[25,4]
SvUpCaseMonth<- UpCase(<In.Date>[5,3])
SvMonthPart<-
If SvUpCaseMonth="JAN" then "01" else
If SvUpCaseMonth="FEB" then "02" else...
SvDayPart<- <In.Date>[9,2]
SvDayOfWeekPart<- <In.Date>[1,1]
TgtDateString<- SvYearPart:"-":SvMonthPart:"-":SvDayPart:" ":SvDayOfWeekPart:" 00:00:00"
Important: The input string has to be exactly the same format every time. Leading Spaces, Variable number of digits or Characters (1 rather than 01, Thurs tather than Thu) will cause this logic to fail.
IHTH
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
Re: changing the dateformat
Hi,ameyvaidya wrote:Hi Scorpion,scorpion wrote:Hi all,
Thu Jan 19 16:59:51 EST 2006
but i need to output as like:
YYYY-MM-DD T 00:00:00 (format)
it will be done by using iconv or oconv functions.but i am not getting reqd.output
can any one help me with exact syntax
Good news:
Like Rasi said, if the source is a string(char or varchar), you can get necessary substrings for the Date and Year directly from the Source.
Bad News:
I could not find any Pattern string that fits the Month part. The resolution would be 12 Nested If-then-else Statements in a stage variable that get the Month Number.
Finally the desired date format can be assembled from the pieces like:
SvYearPart<- <In.Date>[25,4]
SvUpCaseMonth<- UpCase(<In.Date>[5,3])
SvMonthPart<-
If SvUpCaseMonth="JAN" then "01" else
If SvUpCaseMonth="FEB" then "02" else...
SvDayPart<- <In.Date>[9,2]
SvDayOfWeekPart<- <In.Date>[1,1]
TgtDateString<- SvYearPart:"-":SvMonthPart:"-":SvDayPart:" ":SvDayOfWeekPart:" 00:00:00"
Important: The input string has to be exactly the same format every time. Leading Spaces, Variable number of digits or Characters (1 rather than 01, Thurs tather than Thu) will cause this logic to fail.
IHTH
For dates like "2006-MAR-09" can be converted by using StringToDate("2006-MAR-09","%yyyy-%mmm-%dd").
Try this.....