[futurebasic] Re: [FB] Determine what day it is

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2012 : Group Archive : Group : All Groups

From: Brian S <fblistserve@...>
Date: Tue, 3 Apr 2012 11:18:21 -0700
On Apr 3, 2012, at 8:31 AM, Steve wrote:

> What is the best/preferred/non-deprecated method for determining the current day of the week?

The runtime already has a nicely coded non-deprecated CF method. Here are three examples: ( see "date$" in FB help for more  format strings )

'-----------
include "ConsoleWindow"

toolbox fn DateFormatCreateStringWithAbsoluteTime( CFStringRef formatString, CFAbsoluteTime  at ) = CFStringRef

dim as CFStringRef          dateStr

dateStr = fn DateFormatCreateStringWithAbsoluteTime( @"e", fn CFAbsoluteTimeGetCurrent() )   // as a number 0 = Sun
fn ConsolePrintCFString( dateStr )

dateStr = fn DateFormatCreateStringWithAbsoluteTime( @"eee", fn CFAbsoluteTimeGetCurrent() ) // Mon, Tue, etc.
fn ConsolePrintCFString( dateStr ) 

dateStr = fn DateFormatCreateStringWithAbsoluteTime( @"eeee", fn CFAbsoluteTimeGetCurrent() )// Full name
fn ConsolePrintCFString( dateStr ) 
'-----------


Brian S.