Date support for old dates & function 'cross call'

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
tony
User
User
Posts: 26
Joined: Thu May 01, 2003 1:35 am
Location: California
Contact:

Date support for old dates & function 'cross call'

Post by tony »

Hi,

I think two things would be nice to have:
--------------- Date support -------------------
date = ParseDate("%yyyy", "1983")
Debug date

date = ParseDate("%yyyy", "1933")
Debug date
--

The date library doesn't support years before the 1970's (I suppose), which is a real pain.

--------------- Date support -------------------
Procedure a()
b()
EndProcedure

Procedure b()
a()
EndProcedure
--

Well not exatcly that, because it would cause an infinite loop, but something like C's prototypes, that would allow to call a procedure that hasn't been defined yet.

Tony
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Re: Date support for old dates & function 'cross call'

Post by Pupil »

tony wrote: Well not exatcly that, because it would cause an infinite loop, but something like C's prototypes, that would allow to call a procedure that hasn't been defined yet.
You mean 'Declare'?
tony
User
User
Posts: 26
Joined: Thu May 01, 2003 1:35 am
Location: California
Contact:

Post by tony »

tony slaps himself around with a big trout. 'Declare' is what I was looking for. Any idea about the date business?
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

tony wrote:tony slaps himself around with a big trout. 'Declare' is what I was looking for. Any idea about the date business?
You would have to create your own date parser and use API to get the time from that..

For more info see API functions:
'SystemTimeToFileTime', 'FileTimeToSystemTime'
and check out the structures:
'SYSTEMTIME', 'FILETIME'

*Edit: FILETIME doesn't support dates earlier than January 1, 1601.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Date support for old dates & function 'cross call'

Post by Fred »

tony wrote: date = ParseDate("%yyyy", "1983")
Debug date
This already works:

Code: Select all

date = ParseDate("%yyyy", "1983") 
Debug FormatDate("%yyyy", date)
tony
User
User
Posts: 26
Joined: Thu May 01, 2003 1:35 am
Location: California
Contact:

Post by tony »

Yep, but this one doesn't:

date = ParseDate("%yyyy", "1929")
Debug FormatDate("%yyyy", date)
Post Reply