For Programmers: Free Programming Magazines  


Home > Archive > Clipper > February 2005 > convert difference of dates into numeric fields









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author convert difference of dates into numeric fields
happy

2005-02-13, 8:55 am

Can If I have 2 dates to convert the difference between two dates to
numeric"99" , year pict "9999"
Ex :
from date : 01/04/2003
to_date : 31/12/2004
I want the result :
04/2003 05/2003 06/2003 07/2003.....12/2004

diff_year:=year(to_date)-year(from date)
diff_month:=month(to_date)-month(from date)

for i = 1 to diff_month+(diff_year*12)
? diff_month
?? "/"
?? diff_year
i++
next

AUGE_OHR

2005-02-13, 8:55 am

hi,

>for i = 1 to
> ? diff_month
> ?? "/"
> ?? diff_year
> i++
>next


why do you think that you code will give different line than :

8/ 1
8/ 1
8/ 1
8/ 1
8/ 1
8/ 1
8/ 1
8/ 1
8/ 1
8/ 1

greetings by OHR
Jimmy


Ross McKenzie

2005-02-13, 8:55 am

On 13 Feb 2005 00:03:12 -0800, "happy" <ehab_aziz2001@yahoo.com>
wrote:

>Can If I have 2 dates to convert the difference between two dates to
>numeric"99" , year pict "9999"
>Ex :
>from date : 01/04/2003
>to_date : 31/12/2004
>I want the result :
>04/2003 05/2003 06/2003 07/2003.....12/2004
>
>diff_year:=year(to_date)-year(from date)
>diff_month:=month(to_date)-month(from date)
>
>for i = 1 to diff_month+(diff_year*12)
>? diff_month
>?? "/"
>?? diff_year
>i++
>next
>


Why don't you stop wasting our time and just read the bloody manual
where you will learn, if that is possible, that

dDateTo minus dDateFrom returns a bloody number...and

dDate minus a number returns a date.

Apologies to everyone else!!!

pete@nospam.demon.co.uk

2005-02-13, 3:55 pm

In article <420f4225.12848015@news> valusoft "Ross McKenzie" writes:

> On 13 Feb 2005 00:03:12 -0800, "happy" <ehab_aziz2001@yahoo.com>
> wrote:


[the usual]

> Why don't you stop wasting our time and just read the bloody manual
> where you will learn, if that is possible, that


Ah! "if that is possible" is at the heart of the matter.

"Happy" -- please click here: <http://www.XXXXwit.info>

> dDateTo minus dDateFrom returns a bloody number...and
>
> dDate minus a number returns a date.
>
> Apologies to everyone else!!!


I echo Ross' sentiments!

Pete
--
"We have not inherited the earth from our ancestors,
we have borrowed it from our descendants."
Mike

2005-02-13, 3:55 pm

Patience, patience. I think we are within 29 years of the first post
by Happy that "ADDS" to the group knowledge. Since he is about 5 years
old now, he will be able to answer Clipper questions long after we are
gone. Who is going to fix all that code when we approach the 22nd
century? After all 2079 ain't 1979 like it is in our code!

Mike

Rob

2005-02-13, 8:55 pm

(Un)Happy,
Why don't you just come out with it and ask someone else to write what you
want for free so you can look good in front of your boss without having to
make any effort? It would save us all a lot of time...

--
Rob Grattan
R&D Software Pty. Ltd.


Stephen Quinn

2005-02-13, 8:55 pm

Ehab

Look up the following functions in the help/manuals
RIGHT()
SUBSTR()
DTOC()

With those in mind you should be able to work out what you want to achieve.

--
HTH
Steve


gabor salai

2005-02-14, 3:55 pm

"happy" <ehab_aziz2001@yahoo.com> wrote in message
news:1108281792.819432.311840@g14g2000cwa.googlegroups.com...
> Can If I have 2 dates to convert the difference between two dates to
> numeric"99" , year pict "9999"
> Ex :
> from date : 01/04/2003
> to_date : 31/12/2004
> I want the result :
> 04/2003 05/2003 06/2003 07/2003.....12/2004
>
> diff_year:=year(to_date)-year(from date)
> diff_month:=month(to_date)-month(from date)
>
> for i = 1 to diff_month+(diff_year*12)
> ? diff_month
> ?? "/"
> ?? diff_year
> i++
> next


maybe this ...

m_y := "*"
for d := date1 to date2
m_y_1 := strzero(month(d),2) + "/" + strzero(year(d),4)
if m_y_1 != m_y
m_y := m_y_1
? m_y
end if
next



AUGE_OHR

2005-02-14, 3:55 pm

hi,

> for d := date1 to date2


wonderful !
i never think about this

greetings by OHR
Jimmy


gabor salai

2005-02-14, 3:55 pm

"AUGE_OHR" <AUGE_OHR@CSI.COM> wrote in message
news:cuppr2$hi4$05$1@news.t-online.com...
> hi,
>
>
> wonderful !
> i never think about this


enjoy the power of clipper!


tom knauf

2005-02-14, 3:55 pm

Hi,

can anybody tell me how to set a filter in outlook express that happy posts
will never be shown anymore ?


Normally I would tell you, that I am used to read news on my linux systems
and that I tried different things and I would finish with a tia, but that
would be unusual in this threads :-(



"Ross McKenzie" <NoJunk_valusoft@optushome.com.au> schrieb im Newsbeitrag
news:420f4225.12848015@news...
> On 13 Feb 2005 00:03:12 -0800, "happy" <ehab_aziz2001@yahoo.com>
> wrote:
>
>
> Why don't you stop wasting our time and just read the bloody manual
> where you will learn, if that is possible, that
>
> dDateTo minus dDateFrom returns a bloody number...and
>
> dDate minus a number returns a date.
>
> Apologies to everyone else!!!
>



Stephen Quinn

2005-02-15, 3:55 am

Jimmy
[color=darkred]
Would cut down on the number of iterations as well

--
HTH
Steve


Stephen Quinn

2005-02-15, 3:55 am

Tom

Hilight a relevant message in the list then

Tools Menu -> Message Rules -> News
or
Message Menu -> Create Rule from Message
This one will copy the relevant email details into the right places, all you
need do is click the boxes you want.

--
HTH
Steve


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com