Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date which doesnt look like date

Hi everyone...

I'm a new QV user...

and i have a problem wiht a date.

If one of you can help me would be great.

The fact is that I have a Date, which format is something like this

1010224.

the first position is century, next two are year, next two are month and last two day.

I need to convert it to a date format

how i can do it???

thanks...

Angela E

Colombia

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

On the script, you can use makedate() to create a date based on year, month and day.

The syntax is makedate( Year, Month, Day)

In your case, I didn't understand how to get the Year,

Is your example 24/feb/2001 ?

or 24/feb/0001?

But it would be something like this:

makedate(    2000+( 100* (LEFT( YOUR_DATE_FIELD, 1)-1)) + mid(YOUR_DATE_FIELD,2,2), 

mid(YOUR_DATE_FIELD, 4,2), RIGHT( YOUR_DATE_FIELD, 2) )

Sorry if I forgot some ( or )

Hope it helps,

Erich

View solution in original post

2 Replies
erichshiino
Partner - Master
Partner - Master

On the script, you can use makedate() to create a date based on year, month and day.

The syntax is makedate( Year, Month, Day)

In your case, I didn't understand how to get the Year,

Is your example 24/feb/2001 ?

or 24/feb/0001?

But it would be something like this:

makedate(    2000+( 100* (LEFT( YOUR_DATE_FIELD, 1)-1)) + mid(YOUR_DATE_FIELD,2,2), 

mid(YOUR_DATE_FIELD, 4,2), RIGHT( YOUR_DATE_FIELD, 2) )

Sorry if I forgot some ( or )

Hope it helps,

Erich

Not applicable
Author

Thanks a lot !!!