Changeset 1395 for trunk/dll/commafmt.c


Ignore:
Timestamp:
Feb 8, 2009, 2:48:16 AM (17 years ago)
Author:
Gregg Young
Message:

Allow user to turn off alert and/or error beeps in settings notebook. Ticket 341 Move repeated strings to PCSZs. Ticket 6 Add *DateFormat functions to format dates based on locale Ticket 28 Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error Ticket 6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/commafmt.c

    r1205 r1395  
    1515  05 Nov 07 GKY Use commafmtULL to display file sizes for large file support
    1616  10 Nov 07 GKY Get thousands separator from country info for file sizes.
     17  07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
    1718
    1819***********************************************************************/
     
    172173}
    173174
    174 #pragma alloc_text(MISC8,commafmt,CommaFmtU64)
     175VOID DateFormat(PSZ pszBuf, CDATE Date)
     176{
     177  switch(ulDateFmt) {
     178
     179  case 3:
     180
     181    sprintf(pszBuf, "%04u%s%02u%s%02u", Date.year, DateSeparator,
     182            Date.day, DateSeparator, Date.month);
     183    break;
     184
     185  case 2:
     186
     187    sprintf(pszBuf, "%04u%s%02u%s%02u", Date.year, DateSeparator,
     188            Date.month, DateSeparator, Date.day);
     189    break;
     190
     191  case 1:
     192
     193    sprintf(pszBuf, "%02u%s%02u%s%04u", Date.day, DateSeparator,
     194            Date.month, DateSeparator, Date.year);
     195    break;
     196
     197  case 0:
     198  default:
     199
     200    sprintf(pszBuf, "%02u%s%02u%s%04u", Date.month, DateSeparator,
     201            Date.day, DateSeparator, Date.year);
     202    break;
     203  }
     204}
     205
     206VOID FDateFormat(PSZ pszBuf, FDATE Date)
     207{
     208  switch(ulDateFmt) {
     209
     210  case 3:
     211
     212    sprintf(pszBuf, "%04u%s%02u%s%02u", Date.year + 1980, DateSeparator,
     213            Date.day, DateSeparator, Date.month);
     214    break;
     215
     216  case 2:
     217
     218    sprintf(pszBuf, "%04u%s%02u%s%02u", Date.year + 1980, DateSeparator,
     219            Date.month, DateSeparator, Date.day);
     220    break;
     221
     222  case 1:
     223
     224    sprintf(pszBuf, "%02u%s%02u%s%04u", Date.day, DateSeparator,
     225            Date.month, DateSeparator, Date.year + 1980);
     226    break;
     227
     228  case 0:
     229  default:
     230
     231    sprintf(pszBuf, "%02u%s%02u%s%04u", Date.month, DateSeparator,
     232            Date.day, DateSeparator, Date.year + 1980);
     233    break;
     234  }
     235}
     236
     237VOID DTDateFormat(PSZ pszBuf, DATETIME Date)
     238{
     239  switch(ulDateFmt) {
     240
     241  case 3:
     242
     243    sprintf(pszBuf, "%04u%s%02u%s%02u", Date.year, DateSeparator,
     244            Date.day, DateSeparator, Date.month);
     245    break;
     246
     247  case 2:
     248
     249    sprintf(pszBuf, "%04u%s%02u%s%02u", Date.year, DateSeparator,
     250            Date.month, DateSeparator, Date.day);
     251    break;
     252
     253  case 1:
     254
     255    sprintf(pszBuf, "%02u%s%02u%s%04u", Date.day, DateSeparator,
     256            Date.month, DateSeparator, Date.year);
     257    break;
     258
     259  case 0:
     260  default:
     261
     262    sprintf(pszBuf, "%02u%s%02u%s%04u", Date.month, DateSeparator,
     263            Date.day, DateSeparator, Date.year);
     264    break;
     265  }
     266}
     267
     268#pragma alloc_text(MISC8,commafmt,CommaFmtUL,CommaFmtULL)
Note: See TracChangeset for help on using the changeset viewer.