[futurebasic] Re: [FB] How can I get the date in mm/dd/yyyy format

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Thu, 02 Sep 1999 07:06:51 -0500

Jayson Garrett wrote:

> The subject pretty much says it all. :-)
>
> Can someone show me an example of how to get the system date in mmddyyyy
> format? DATE$() only returns 2 digits for the year, and I need to retrofit a
> program I have for the new year.

IUDATESTRING works pretty well as long as all you intend to do is display the
date, and you're willing to use the date format that the user has selected in
the "Date & Time" control panel.  But it's not very reliable if you need to
extract the individual date fields, because you can't count on them being in a
fixed location within the string that IUDATESTRING returns.  For example, the
last 4 characters of the string will _probably_ be the year, but you can't
guarantee that (the user might have set the display format to "yyyy-mm-dd").

If you need to get the individual date fields, use the SECS2DATE routine.
Here's an example:

DIM dateRec.14
CALL SECS2DATE([_time], @dateRec)
PRINT dateRec.month
PRINT dateRec.day
PRINT dateRec.year

- Rick