Page 1 of 1
Date manipulation
Posted: Sun Aug 28, 2005 6:03 pm
by varshanswamy
Hi,
I have input value for date as follows
28/Aug/2005:17:00:07
I need to obtain the following string
2005-08-28 17:00:07
I have used many stage variables to get the above value.
what is the best way to get the above mentioned value.
regards,
varsha
Posted: Sun Aug 28, 2005 6:52 pm
by ray.wurlod
Some combination of Date/String conversion functions with appropriate date picture arguments.
Stage variables are OK too; they become local variables in the generated code.
Posted: Sun Aug 28, 2005 10:26 pm
by kumar_s
Hi,
Is the value of date "28/Aug/2005:17:00:07" in sequential file or in database.
Coz if it is sequential file, you can read it as varchar and so you can avoid a string conversion.
And so you can convert the string to date using funciton.
regards
kumar
Posted: Mon Aug 29, 2005 1:59 am
by info_ds
hi varsha,
date format as u have mentioned
d1=28/Aug/2005:17:00:07
i tried like this.
DateToString(StringToDate(Left(d1,11),"%dd/%mmm/%yyyy"),"%yyyy-%mm-%dd") : " " : Right(d1,8)
it works fine.
Posted: Mon Aug 29, 2005 2:07 am
by info_ds
sorry it is
Right(d1,8)
Posted: Mon Aug 29, 2005 8:54 am
by varshanswamy
info_ds wrote:hi varsha,
date format as u have mentioned
d1=28/Aug/2005:17:00:07
i tried like this.
DateToString(StringToDate(Left(d1,11),"%dd/%mmm/%yyyy"),"%yyyy-%mm-%dd") : " " : Right(d1,8)
it works fine.
Thankz for the input, the code works.
regards,
varsha