Write the date and time as per the supplied format. The options are:- 1) As YYYYMMDD 2) As dayname, monthname day year (American) 3) As dayname, day monthname year (International) Pointer to buffer populated with the date in text form. Note: The space required is allocated from the thread scratch pad and must not be deleted by the calling function.

Return TypeFunction nameArguments
const char*hzXDate::Txt(hzDateFmt,)

Declared in file: hzDate.h
Defined in file : hzDate.cpp

Function Logic:

0:START 1:unknown 2:Return 0 3:pBuf 4:unknown 5:unknown 6:items 7:items 8:Return pBuf 9:items items 10:unknown 11:unknown 12:items 13:items 14:nSofar 15:unknown 16:unknown 17:pBuf items eFmt 18:eFmt&FMT_DT_MASK_DATES 19:FMT_DATE_DFLT 20:nSofar

Function body:

const char* hzXDate::Txt (hzDateFmt eFmt)
{
   //  Write the date and time as per the supplied format. The options are:-
   //  
   //   1) As YYYYMMDD
   //   2) As dayname, monthname day year (American)
   //   3) As dayname, day monthname year (International)
   //  
   //  Arguments: 1) eFmt Requested format of output string
   //  
   //  Returns: Pointer to buffer populated with the date in text form.
   //  
   //  Note: The space required is allocated from the thread scratch pad and must not be deleted by the calling function.
   _hzfunc("hzXDate::Txt") ;
   char*   pBuf ;          //  Text recepticle
   bool    bUS ;           //  True if American format required
   bool    bFN ;           //  True if full names are required
   int32_t nSofar = 0; //  Length so far.
   if (!m_hour && !m_usec)
       return 0;
   pBuf = _thisfn.ScratchPad(32);
   //  if (m_hour & 0x80000000)
   //   { strcpy(pBuf, "Not set") ; return pBuf ; }
   //  Do we have the full blown internet format?
   if (eFmt == FMT_DT_INET)
   {
       if (bUS)
           sprintf(pBuf, "%s %s %d %04d %02d:%02d:%02d +0000 (GMT)", hz_daynames_abrv[Dow()], hz_monthnames_abrv[Month() - 1],Day(), Year(), Hour(), Min(), Sec()) ;
       else
           sprintf(pBuf, "%s %d %s %04d %02d:%02d:%02d +0000 (GMT)", hz_daynames_abrv[Dow()], Day(), hz_monthnames_abrv[Month() - 1],Year(), Hour(), Min(), Sec()) ;
       return pBuf ;
   }
   //  US or International
   bUS = eFmt & FMT_DATE_USA ? true : false ;
   bFN = eFmt & FMT_DATE_FULL ? true : false ;
   //  Do we have a dow? if so print this first
   if (eFmt & FMT_DATE_DOW)
   {
       if (bFN)
           strcpy(pBuf, hz_daynames_full[Dow()]) ;
       else
           strcpy(pBuf, hz_daynames_abrv[Dow()]) ;
       nSofar = strlen(pBuf) ;
   }
   //  Now print date
   if (eFmt & FMT_DT_MASK_DATES)
   {
       if (nSofar)
       {
           pBuf[nSofar] = CHAR_SPACE ;
           nSofar++ ;
       }
       switch (eFmt & FMT_DT_MASK_DATES)
       {
       case FMT_DATE_DFLT: //  YYYYMMDD
                           nSofar += sprintf(pBuf + nSofar, "%04d%02d%02d", Year(), Month(), Day());
                           break ;
       case FMT_DATE_STD:  //  YYYY/MM/DD
                           nSofar += sprintf(pBuf + nSofar, "%04d/%02d/%02d", Year(), Month(), Day());
                           break ;
       case FMT_DATE_NORM: //  DD/MM/YYYY (UK) or MM/DD/YYYY (US)
                           if (bUS)
                               nSofar += sprintf(pBuf + nSofar, "%02d/%02d/%04d", Month(), Day(), Year()) ;
                           else
                               nSofar += sprintf(pBuf + nSofar, "%02d/%02d/%04d", Day(), Month(), Year()) ;
                           break ;
       case FMT_DATE_FULL: //  Day_of_month+monthname+YYYY (UK) or monthname+day_of_month+YYYY (US)
                           if (bUS)
                               nSofar += sprintf(pBuf + nSofar, "%s %d %04d", hz_monthnames_abrv[Month() - 1],Day(), Year()) ;
                           else
                               nSofar += sprintf(pBuf + nSofar, "%d %s %04d", Day(), hz_monthnames_abrv[Month() - 1],Year()) ;
                           break ;
       }
   }
   //  Now print time
   if (eFmt & FMT_DT_MASK_TIMES)
   {
       if (nSofar)
       {
           pBuf[nSofar] = CHAR_MINUS ;
           nSofar++ ;
       }
       switch (eFmt & FMT_DT_MASK_TIMES)
       {
       case FMT_TIME_DFLT: //  Time HHMMSS
                           nSofar += sprintf(pBuf + nSofar, "%02d%02d%02d", Hour(), Min(), Sec()) ;
                           break ;
       case FMT_TIME_STD:  //  Time HH:MM:SS
                           nSofar += sprintf(pBuf + nSofar, "%02d:%02d:%02d", Hour(), Min(), Sec()) ;
                           break ;
       case FMT_TIME_USEC: //  Time HH:MM:SS.uSec
                           nSofar += sprintf(pBuf + nSofar, "%02d:%02d:%02d.%06d", Hour(), Min(), Sec(), uSec()) ;
                           break ;
       }
   }
   //  Now print timezone if applicable
   if (eFmt & FMT_DT_MASK_TZONE)
   {
       if (nSofar)
       {
           pBuf[nSofar] = CHAR_SPACE ;
           nSofar++ ;
       }
       switch (eFmt & FMT_DT_MASK_TIMES)
       {
       case FMT_TZ_CODE:   strcpy(pBuf + nSofar, "GMT") ;          break ;
       case FMT_TZ_NUM:    strcpy(pBuf + nSofar, "+0000") ;        break ;
       case FMT_TZ_BOTH:   strcpy(pBuf + nSofar, "+0000 (GMT)") ;  break ;
       }
   }
   return pBuf ;
}