Help with 4 digit numbers to date format?

ma143hal

New member
Local time
Today, 15:08
Joined
Mar 22, 2006
Messages
7
Hello,

I have extracted 4 digit numbers from a long strings of characters and numbers which I have identified as date. Some are inputted as

mmdd (example: 1129)
ddmm (example: 2310)


I have to calculate the number of days between the start and end dates. I tried formatting as date, but I can't get it to work.

Any suggestion?

Thanks!
 
Hi -

In your examples (1129, 2310), it's easy to determine which represents month and which represents day. Example of returning these as dates follows. However, unless there's some indicator as to what the numbers represent, you'll hit a brick wall when it comes to something like 1211. Does it represent December 11th or November 12th?
Example from the debug (immediate) window:
Code:
x = 1129
y = x\100
z = x mod 100
a = dateserial(year(date()), y, z)
? a
11/29/06 

x = 2310
y = x mod 100
z = x\100
b = dateserial(year(date()), y, z)
? b
10/23/06
 
? datediff("d", b, a)
 37

It's defective design. Need to go back and take a look

HTH - Bob
 
Last edited:

Users who are viewing this thread

Back
Top Bottom