0

Hi,
I have a Date field and DateTime filed as string variables.

Now i want to customize their formats as like given below.

Ex-1: 20091024
if i specify the seperator as '/' then 2009/10/24
'-' Then 2009-10-24
Ex-2: 200910241011012
if i specify the seperator as '/,:' then 2009/10/24 10:11:12
'-,:' then 2009-10-24 10:11:12

Can any one suggest is there any methods to achive this ??
Thank you very much in advance

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by pvsumanbabu
0

Three thoughts. You might look up the ctime header file and see if there is a standard way to do what you want. Otherwise you can develop your own functions to do what you want. I don't think there is anything in iomanip that help you, but you could check there as well.

0

Thank u very much for the reply,

I have implemented this logic like below.

year=first 4 digits of date string;
month=5,6 digits in date string;
year=7,8 digits in date string;
sprintf(FormattedDate,"%d/%d/%d",year,month,date);

then use finally FormattedDate.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.