On Wed, Aug 10, 2016 at 5:22 PM, Chip Scheide <[email protected]> wrote:

> these are things that we all have had to create
> if 4D put these into the language then not only would we not have to do
> this, but it would automatically be localized

You can make your own method to get this information from the system -- 
automatically localized -- by using the 4D “String” command. Here’s some code 
to do this:

  // ===========================================
  // PROJECT METHOD: GetMonthName

  // PARAMETERS: $0 = month name
  // $1 = month number

  // DESCRIPTION: Returns the month name using 4D String command.

  // CREATED BY: Tim Nevels, Innovative Solutions ©2014
  // DATE: 7/12/14
  // LAST MODIFIED: 
  // ============================================

C_TEXT($0)
C_LONGINT($1;$monthNumber_l)
$monthNumber_l:=$1

C_TEXT($dateString_t)

$dateString_t:=String(Add to date(!00/00/0000!;2014;$monthNumber_l;1);Internal 
date long)

$0:=Substring($dateString_t;1;Position(" ";$dateString_t)-1)


  // ===========================================
  // PROJECT METHOD: GetWeekdayName

  // PARAMETERS: $0 = weekday name
  // $1 = day number

  // DESCRIPTION: Returns the weekday name using 4D String command.

  // CREATED BY: Tim Nevels, Innovative Solutions ©2014
  // DATE: 7/12/14
  // LAST MODIFIED: 
  // ============================================

C_TEXT($0)
C_LONGINT($1;$dayNumber_l)
$dayNumber_l:=$1

C_TEXT($dateString_t)
C_DATE($tempDate_d)
C_LONGINT($i)

  // get a date that is on the day number needed
For ($i;1;7)
   $tempDate_d:=Add to date(!00/00/0000!;2014;1;$i)
   If (Day number($tempDate_d)=$dayNumber_l)
      $i:=9  // abort loop
   End if 
End for 

$dateString_t:=String($tempDate_d;System date long)

$0:=Substring($dateString_t;1;Position(",";$dateString_t)-1)


Tim

********************************************
Tim Nevels
Innovative Solutions
785-749-3444
[email protected]
********************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to