RE: [U2] Time/Date as a single number

2006-09-13 Thread Kevin King
In that case I think I'd go with the concatenation option:

DATE()"R%5" : TIME()"R%5"

At least that'll get you up to October 14, 2241.  Hopefully by then
barcodes will have been replaced by telepathy.

-Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com
 
** Check out scheduled Connect! training courses at
http://www.PrecisOnline.com/train.html.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of George Gallen
Sent: Wednesday, September 13, 2006 8:19 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Time/Date as a single number

yes. It needs to be to the second.

My final solution at present, is to use 01/01/2006 as my base for the
date, use the date*86400+time encoding, with my other manipulations,
this will give me a span of about 12 years, and if this system is
still in place in 12 years without being upgraded...well.

My other option, is to shrink the barcode size to allow for more room,
but right now, it's pretty small to begin with, and I'd rather not
make it unscanable.

For those asking, it's a code128 barcode subset C. The barcode doesn't
need the checksum, but rather the other side does, which I have no
control over, except for the definition of the number, but the
checksum is still required.

George


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Steve
Johnson
> Sent: Tuesday, September 12, 2006 6:12 PM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] Time/Date as a single number
> 
> 
> George,
> 
> Do you need to be accurate to one second? If you can live with 
> 10-second precision you can save one digit.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-13 Thread George Gallen
yes. It needs to be to the second.

My final solution at present, is to use 01/01/2006 as my base for the date,
use the date*86400+time encoding, with my other manipulations, this will give
me a span of about 12 years, and if this system is still in place in 12 years
without being upgraded...well.

My other option, is to shrink the barcode size to allow for more room, but right
now, it's pretty small to begin with, and I'd rather not make it unscanable.

For those asking, it's a code128 barcode subset C. The barcode doesn't need
the checksum, but rather the other side does, which I have no control over,
except for the definition of the number, but the checksum is still required.

George


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Steve Johnson
> Sent: Tuesday, September 12, 2006 6:12 PM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] Time/Date as a single number
> 
> 
> George,
> 
> Do you need to be accurate to one second? If you can live with
> 10-second precision you can save one digit.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Time/Date as a single number

2006-09-13 Thread Mark Johnson
I worked on a Security Monitoring system for years and the best date/time
schema is

(DATE()*86400)+TIME()

It's incredibly useful when detecting time differences between 2 times that
may or may not cross a day boundary.

It was never meant to be an alternative to the DATE() and TIME() functions
alone.

The DATE()-1 concept would mean that you're trying to replace the DATE()
method and you're correct. With the method mentioned above, it really
doesn't matter as long as its consistent because the date expressions.

During my time when using the method above, it never was a replacement for
the actual date and time of an occurrence. It was simply used to derive the
time 'difference' as many signals, alarms and incidents in the security
monitoring business are time sensitive, ie received 2 signals within 15
minutes, which could obviously cross midnight.

My 1 cent
Mark Johnson
- Original Message -
From: "Kevin King" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, September 12, 2006 4:45 PM
Subject: RE: [U2] Time/Date as a single number


> >My method is take date()*86400+time()
>
> Is the goal to track a chronology via a single field? If so, I'd say
> your calulation is close.  Wouldn't it be:
>
> ((DATE() - 1) * 86500) + TIME()
>
> (...as the number of days elapsed is today - 1, not today.)
>
> Regardless, you're right that the date could get humongous.  For the
> cycles you're going through to do this calculation it would be a small
> step to convert it into and out of any other base to compress and
> decompress the bytes.
>
> The foundational question, however, is one of context.  Why do you
> need this?  That answer may limit or expand your options.
>
> -Kevin
> [EMAIL PROTECTED]
> http://www.PrecisOnline.com
>
> ** Check out scheduled Connect! training courses at
> http://www.PrecisOnline.com/train.html.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-13 Thread Ross Ferris
Or simply drop the first character - day 2 isn't until October 2022
- simple prefix a "1" to first 4 digits

Ross Ferris
Stamina Software
Visage > Better by Design!

>-Original Message-
>From: [EMAIL PROTECTED] [mailto:owner-u2-
>[EMAIL PROTECTED] On Behalf Of Brad Moll
>Sent: Wednesday, 13 September 2006 8:53 AM
>To: u2-users@listserver.u2ug.org
>Subject: RE: [U2] Time/Date as a single number
>
>If you want a smaller number and you don't have to really worry about
>historical dates, you could shift the date and use 1/1/2000 as day 1 by
>subtracting 11688 from the date before you do the multiplication.
>
>Brad Moll
>JK Consulting Services, Inc.
>Phone:  (763)754-5354
>Fax:  (763)463-1750
>
>-Original Message-
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Steve Johnson
>Sent: Tuesday, September 12, 2006 4:31 PM
>To: u2-users@listserver.u2ug.org
>Subject: Re: [U2] Time/Date as a single number
>
>In my application, I add a constant (134408) to the date so that it is
>always > 0. Then I right-justify and zero-fill to a constant length
both
>date (plus constant) and time and delimit them with a literal ":". This
>gives me a  non-numeric string with a constant length by which I can
sort
>if
>need be.
>
>FWIW, the constant 134408 works with dates back to 1-Jan-1600. (Dates
>earlier than year 1583 don't seem to work on UniData.)
>
>Steve Johnson
>
>On 9/12/06, George Gallen <[EMAIL PROTECTED]> wrote:
>> OK. what is the ?best? way to store the time/date (to the second) as
a
>> single number
>>similar to unix's epoch, although I'm not looking to convert it to
>> unix format.
>>
>> My method is take date()*86400+time()
>> idate=int(combo/86400), itime=combo-(idate*86400)
>>
>> Is there anyway to do this giving less than 10 characters (and stay
in
>> base
>> 10) ?
>>
>> George Gallen
>> Senior Programmer/Analyst
>> Accounting/Data Division
>> [EMAIL PROTECTED]
>> ph:856.848.1000 Ext 220
>>
>> SLACK Incorporated - Delivering the best in health care information
>> and education worldwide.
>> http://www.slackinc.com
>> ---
>> u2-users mailing list
>> u2-users@listserver.u2ug.org
>> To unsubscribe please visit http://listserver.u2ug.org/
>---
>u2-users mailing list
>u2-users@listserver.u2ug.org
>To unsubscribe please visit http://listserver.u2ug.org/
>---
>u2-users mailing list
>u2-users@listserver.u2ug.org
>To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread [EMAIL PROTECTED]
Mike wrote:

> INT(((DATE() - 1) * 86500) + TIME())

Bloody New Zealanders! - trying to sneak an extra minute and
40 seconds into our working day - eh bro?

Cheers,

Ken
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Allen E. Elwood
And 30 years from now it won't matter :-)  

Reminds me of y2k...hehNot My Problem they used to saysnicker

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of David A. Green
Sent: Tuesday, September 12, 2006 16:18
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Time/Date as a single number


How about 
MY.IDATE = DATE()-14000 "4\0R":INT(TIME()) "5\0R" 

This will give you 9 digits for over 30 years.

THE.DATE = OCONV(MY.IDATE[1, 4], "D")
THE.TIME = OCONV(MY.IDATE[5, 5], "MTHS")

Thanks,
David A. Green
DAG Consulting


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of George Gallen
 
I'm limited to 10 characters, and to a barcode that will only
use 0-9. Problem is one of the 10 characters will need to be
a basic checksum, which drops me to 9 numbers. 

I could cheat a little, since none of the dates would be before
Oct 2006.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread David A. Green
How about 
MY.IDATE = DATE()-14000 "4\0R":INT(TIME()) "5\0R" 

This will give you 9 digits for over 30 years.

THE.DATE = OCONV(MY.IDATE[1, 4], "D")
THE.TIME = OCONV(MY.IDATE[5, 5], "MTHS")

Thanks,
David A. Green
DAG Consulting


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of George Gallen
 
I'm limited to 10 characters, and to a barcode that will only
use 0-9. Problem is one of the 10 characters will need to be
a basic checksum, which drops me to 9 numbers. 

I could cheat a little, since none of the dates would be before
Oct 2006.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Brad Moll
If you want a smaller number and you don't have to really worry about
historical dates, you could shift the date and use 1/1/2000 as day 1 by
subtracting 11688 from the date before you do the multiplication.

Brad Moll
JK Consulting Services, Inc.
Phone:  (763)754-5354
Fax:  (763)463-1750

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve Johnson
Sent: Tuesday, September 12, 2006 4:31 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Time/Date as a single number

In my application, I add a constant (134408) to the date so that it is
always > 0. Then I right-justify and zero-fill to a constant length both
date (plus constant) and time and delimit them with a literal ":". This
gives me a  non-numeric string with a constant length by which I can sort if
need be.

FWIW, the constant 134408 works with dates back to 1-Jan-1600. (Dates
earlier than year 1583 don't seem to work on UniData.)

Steve Johnson

On 9/12/06, George Gallen <[EMAIL PROTECTED]> wrote:
> OK. what is the ?best? way to store the time/date (to the second) as a 
> single number
>similar to unix's epoch, although I'm not looking to convert it to 
> unix format.
>
> My method is take date()*86400+time()
> idate=int(combo/86400), itime=combo-(idate*86400)
>
> Is there anyway to do this giving less than 10 characters (and stay in 
> base
> 10) ?
>
> George Gallen
> Senior Programmer/Analyst
> Accounting/Data Division
> [EMAIL PROTECTED]
> ph:856.848.1000 Ext 220
>
> SLACK Incorporated - Delivering the best in health care information 
> and education worldwide.
> http://www.slackinc.com
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Bruce Nichol

Goo'day, George,

At 17:31 12/09/06 -0400, you wrote:


I'm limited to 10 characters, and to a barcode that will only
use 0-9. Problem is one of the 10 characters will need to be
a basic checksum, which drops me to 9 numbers. (this can't change
it's the way the bar code reader/decoder is setup).

I figured 86400, from 60 sec * 60 min * 24 hours

I could cheat a little, since none of the dates would be before
Oct 2006.

But it doesn't leave me much room. I really don't know what the
upper date limit will be (I'd like to be able to work with 10
years at a min.) which is 3660 * 86400 = 31622400, which works.

I think I have it worked out, but it's messy using all kinds of
bit manipulation and packing, hoping it's not too slow.


Would you achieve anything by setting a base at, say, 1st October, 2006 and 
simply using your 10 years of seconds (about 316,000,000) or even more, as 
an add-on to that?That gives about 30 years.


That way you've got 9 digits or less, and no packing/unpacking, etc...

For example, 1st October is day 14154, a seconds count of 12345657 = 205760 
minutes = 3429 hours = 142 days which gives day 14295 = 19th Feb, 
2007.  A seconds count of 987654321 (9 digits) = 16460905 minutes  = 
274348 hours = 11431 days = day 25584 = 16th Jan 2038.. More than your 
required 10 years worth





George

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Kevin King
> Sent: Tuesday, September 12, 2006 4:45 PM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] Time/Date as a single number
>
>
> >My method is take date()*86400+time()
>
> Is the goal to track a chronology via a single field? If so, I'd say
> your calulation is close.  Wouldn't it be:
>
> ((DATE() - 1) * 86500) + TIME()
>
> (...as the number of days elapsed is today - 1, not today.)
>
> Regardless, you're right that the date could get humongous.  For the
> cycles you're going through to do this calculation it would be a small
> step to convert it into and out of any other base to compress and
> decompress the bytes.
>
> The foundational question, however, is one of context.  Why do you
> need this?  That answer may limit or expand your options.
>
> -Kevin
> [EMAIL PROTECTED]
> http://www.PrecisOnline.com
>
> ** Check out scheduled Connect! training courses at
> http://www.PrecisOnline.com/train.html.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.1.406 / Virus Database: 268.12.3/446 - Release Date: 12/09/06


Regards,

Bruce Nichol
Talon Computer Services
ALBURYNSW 2640
Australia

http://www.taloncs.com.au

Tel: +61 (0)411149636
Fax: +61 (0)260232119

If it ain't broke, fix it till it is! 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.406 / Virus Database: 268.12.3/446 - Release Date: 12/09/06
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Glen Batchelor
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:owner-u2-
> [EMAIL PROTECTED] On Behalf Of George Gallen
> Sent: Tuesday, September 12, 2006 5:32 PM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] Time/Date as a single number
> 
> I'm limited to 10 characters, and to a barcode that will only
> use 0-9. Problem is one of the 10 characters will need to be
> a basic checksum, which drops me to 9 numbers. (this can't change
> it's the way the bar code reader/decoder is setup).
> 

 Which symbology are you using? We normally use 39, since it allows us to
barcode letters and a few non-alphanumeric values.

> I figured 86400, from 60 sec * 60 min * 24 hours
> 
> I could cheat a little, since none of the dates would be before
> Oct 2006.
> 
> But it doesn't leave me much room. I really don't know what the
> upper date limit will be (I'd like to be able to work with 10
> years at a min.) which is 3660 * 86400 = 31622400, which works.
> 
> I think I have it worked out, but it's messy using all kinds of
> bit manipulation and packing, hoping it's not too slow.
> 
> George


Glen
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Glen Batchelor
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:owner-u2-
> [EMAIL PROTECTED] On Behalf Of George Gallen
> Sent: Tuesday, September 12, 2006 3:16 PM
> To: u2-users@listserver.u2ug.org
> Subject: [U2] Time/Date as a single number
> 
> OK. what is the ?best? way to store the time/date (to the second) as a
> single
> number
>similar to unix's epoch, although I'm not looking to convert it to unix
> format.
> 
> My method is take date()*86400+time()
> idate=int(combo/86400), itime=combo-(idate*86400)
> 
> Is there anyway to do this giving less than 10 characters (and stay in
> base
> 10) ?
> 

  No. You are dealing with a large number to start with, in base 10. You can
either convert to another numerical base or encode the value into ASCII.
This program will cut your string size in half, by using a 2-digit ASCII
char translate. You don't want to use this if you are displaying the fields.
Escape and control sequences may be formed, unless you literally map 00 ->
99 onto specific printable characters.

  SUBROUTINE ASCII.XLATE(INBUF,OUTBUF,MODE)
  $OPTIONS EXT
  !
  !ENCODE
  !
  IF MODE = 1 THEN
 SLEN = LEN(INBUF)
 IF MOD(SLEN, 2) THEN INBUF = "0":INBUF
 SLEN = LEN(INBUF)
 FOR PTR = SLEN-1 TO 1 STEP -2
  ! GET TWO-BYTE VALUES RIGHT-TO-LEFT
SVAL = INBUF[PTR,2]
  ! SKIP FIRST 6 ASCII CHARS
SVAL = SVAL + 6
  ! CONVERT TO ASCII
SCHAR = CHAR(SVAL)
  ! APPEND TO STRING
OUTBUF = OUTBUF:SCHAR
 NEXT PTR
  END
  !
  !DECODE
  !
  IF MODE = 2 THEN
 SLEN = LEN(INBUF)
 FOR PTR = SLEN TO 1 STEP -1
  ! CONVERT EACH CHARACTER TO A DECIMAL VALUE
  ! SUBTRACT 6 TO GET ORIGINAL DECIMAL VALUE
SCHAR = INBUF[PTR,1]
SVAL = SEQ(SCHAR)-6
  ! WRAP WITH ZERO TO ENFORCE DUAL-DIGIT TRANSLATION
SVAL = "00":SVAL
SVAL = SVAL"R%2"
OUTBUF = OUTBUF:SVAL
  ! FORCE TO NUMERIC, WHICH WILL REMOVE LEADING ZEROS
OUTBUF = OUTBUF + 0
 NEXT PTR
  END
  RETURN

> George Gallen
> Senior Programmer/Analyst
> Accounting/Data Division
> [EMAIL PROTECTED]
> ph:856.848.1000 Ext 220

Glen
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Time/Date as a single number

2006-09-12 Thread Steve Johnson

George,

Do you need to be accurate to one second? If you can live with
10-second precision you can save one digit.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number {Unclassified}

2006-09-12 Thread HENDERSON MIKE, MR
George

INT(((DATE() - 1) * 86500) + TIME())

will stay as ten digits until 07 JUL 2284, which might well be long
enough for your purposes

07 JUL 2284 is a ten-digit date+time:-
LIST file SAMPLE 1 EVAL"((DATE()+101470) * 86500) + TIME()"
EVAL"OCONV(DATE()+101470,"DE")"
ID955099.016  07 JUL 2284

But 08 JUL 2284 is an eleven-digit date+time:-
LIST file SAMPLE 1 EVAL"((DATE()+101471) * 86500) + TIME()"
EVAL"OCONV(DATE()+101471,"DE")"
ID   1041589.031  08 JUL 2284


HTH

Mike

> -Original Message-
> From: [EMAIL PROTECTED] On Behalf Of George Gallen
> Sent: Wednesday, 13 September 2006 07:16
> To: u2-users@listserver.u2ug.org
> Subject: [U2] Time/Date as a single number
>
> OK. what is the ?best? way to store the time/date (to the
> second) as a single number similar to unix's epoch, although
> I'm not looking to convert it to unix format.
>
> My method is take date()*86400+time()
> idate=int(combo/86400), itime=combo-(idate*86400)
>
> Is there anyway to do this giving less than 10 characters
> (and stay in base 10) ?
>
> George Gallen


The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy or
distribute this message or the information in it.

If you have received this message in error, please Email or telephone
the sender immediately.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Time/Date as a single number

2006-09-12 Thread [EMAIL PROTECTED]
> OK. what is the ?best? way to store the time/date (to the
> second) as a single number
>similar to unix's epoch, although I'm not looking to
> convert it to unix format.
> 
> My method is take date()*86400+time()
> idate=int(combo/86400), itime=combo-(idate*86400)
> 
> Is there anyway to do this giving less than 10 characters
> (and stay in base 10) ?

I suppose it depends whether you want to be able to do
accurate maths with multiple date/time values.  If not, I'd
probably go with DATE():".":TIME() (or DATE()-1:".":TIME()).
 If you need to be able to do calculations with these
numbers and come up with accurate intervals as a result then
you'd need to either multiply the DATE() component as has
been suggested, or divide the TIME() component.  Personally,
I'd go with the "divide the time component" option:
DATE()+(TIME()/86400).

Cheers,

Ken
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread George Gallen
I'm limited to 10 characters, and to a barcode that will only
use 0-9. Problem is one of the 10 characters will need to be
a basic checksum, which drops me to 9 numbers. (this can't change
it's the way the bar code reader/decoder is setup).

I figured 86400, from 60 sec * 60 min * 24 hours

I could cheat a little, since none of the dates would be before
Oct 2006.

But it doesn't leave me much room. I really don't know what the
upper date limit will be (I'd like to be able to work with 10 
years at a min.) which is 3660 * 86400 = 31622400, which works.

I think I have it worked out, but it's messy using all kinds of
bit manipulation and packing, hoping it's not too slow.

George

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Kevin King
> Sent: Tuesday, September 12, 2006 4:45 PM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] Time/Date as a single number
> 
> 
> >My method is take date()*86400+time()
> 
> Is the goal to track a chronology via a single field? If so, I'd say
> your calulation is close.  Wouldn't it be:
> 
> ((DATE() - 1) * 86500) + TIME()
> 
> (...as the number of days elapsed is today - 1, not today.)
> 
> Regardless, you're right that the date could get humongous.  For the
> cycles you're going through to do this calculation it would be a small
> step to convert it into and out of any other base to compress and
> decompress the bytes.
> 
> The foundational question, however, is one of context.  Why do you
> need this?  That answer may limit or expand your options.
> 
> -Kevin
> [EMAIL PROTECTED]
> http://www.PrecisOnline.com
>  
> ** Check out scheduled Connect! training courses at
> http://www.PrecisOnline.com/train.html.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Bob Woodward
Can't you take the max value length and use that to format your
calculated time, zero filling, then take the left most 10 characters and
multiply that by 1?  Like Kevin said, it really depends on what you're
ultimately looking for.

BobW
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin King
Sent: Tuesday, September 12, 2006 1:45 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Time/Date as a single number

>My method is take date()*86400+time()

Is the goal to track a chronology via a single field? If so, I'd say
your calulation is close.  Wouldn't it be:

((DATE() - 1) * 86500) + TIME()

(...as the number of days elapsed is today - 1, not today.)

Regardless, you're right that the date could get humongous.  For the
cycles you're going through to do this calculation it would be a small
step to convert it into and out of any other base to compress and
decompress the bytes.

The foundational question, however, is one of context.  Why do you
need this?  That answer may limit or expand your options.

-Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com
 
** Check out scheduled Connect! training courses at
http://www.PrecisOnline.com/train.html.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Time/Date as a single number

2006-09-12 Thread Steve Johnson

In my application, I add a constant (134408) to the date so that it is
always > 0. Then I right-justify and zero-fill to a constant length
both date (plus constant) and time and delimit them with a literal
":". This gives me a  non-numeric string with a constant length by
which I can sort if need be.

FWIW, the constant 134408 works with dates back to 1-Jan-1600. (Dates
earlier than year 1583 don't seem to work on UniData.)

Steve Johnson

On 9/12/06, George Gallen <[EMAIL PROTECTED]> wrote:

OK. what is the ?best? way to store the time/date (to the second) as a single
number
   similar to unix's epoch, although I'm not looking to convert it to unix
format.

My method is take date()*86400+time()
idate=int(combo/86400), itime=combo-(idate*86400)

Is there anyway to do this giving less than 10 characters (and stay in base
10) ?

George Gallen
Senior Programmer/Analyst
Accounting/Data Division
[EMAIL PROTECTED]
ph:856.848.1000 Ext 220

SLACK Incorporated - Delivering the best in health care information and
education worldwide.
http://www.slackinc.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread José Luis Gutiérrez de la Peza
You can concatenate both numbers :

Datetimefield = date() 'MR%5':time() 'MR%5'

And then

Idate = Datetimefield[1,5] 

And 

Itime = Datetiefield[6,5]

I hope it works.

Regards

Josi Luis Gutierrez de la Peza
ABDP

-Mensaje original-
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] En nombre de George Gallen
Enviado el: Martes, 12 de Septiembre de 2006 02:16 p.m.
Para: u2-users@listserver.u2ug.org
Asunto: [U2] Time/Date as a single number

OK. what is the ?best? way to store the time/date (to the second) as a
single
number
   similar to unix's epoch, although I'm not looking to convert it to unix
format.

My method is take date()*86400+time()
idate=int(combo/86400), itime=combo-(idate*86400)

Is there anyway to do this giving less than 10 characters (and stay in base
10) ?

George Gallen
Senior Programmer/Analyst
Accounting/Data Division
[EMAIL PROTECTED]
ph:856.848.1000 Ext 220

SLACK Incorporated - Delivering the best in health care information and
education worldwide.
http://www.slackinc.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Barry Brevik
>My method is take date()*86400+time()

If this is UV, I believe that SYSTEM(99) returns seconds since 01-01-1970. 
Right now on my system, and for a long time to come, it is returning a 10 digit 
number.

Barry Brevik
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Time/Date as a single number

2006-09-12 Thread Kevin King
>My method is take date()*86400+time()

Is the goal to track a chronology via a single field? If so, I'd say
your calulation is close.  Wouldn't it be:

((DATE() - 1) * 86500) + TIME()

(...as the number of days elapsed is today - 1, not today.)

Regardless, you're right that the date could get humongous.  For the
cycles you're going through to do this calculation it would be a small
step to convert it into and out of any other base to compress and
decompress the bytes.

The foundational question, however, is one of context.  Why do you
need this?  That answer may limit or expand your options.

-Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com
 
** Check out scheduled Connect! training courses at
http://www.PrecisOnline.com/train.html.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


[U2] Time/Date as a single number

2006-09-12 Thread George Gallen
OK. what is the ?best? way to store the time/date (to the second) as a single
number
   similar to unix's epoch, although I'm not looking to convert it to unix
format.

My method is take date()*86400+time()
idate=int(combo/86400), itime=combo-(idate*86400)

Is there anyway to do this giving less than 10 characters (and stay in base
10) ?

George Gallen
Senior Programmer/Analyst
Accounting/Data Division
[EMAIL PROTECTED]
ph:856.848.1000 Ext 220

SLACK Incorporated - Delivering the best in health care information and
education worldwide.
http://www.slackinc.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/