Jump to content











Photo

StrFormat,DATE


  • Please log in to reply
1 reply to this topic

#1 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12688 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 19 December 2008 - 11:34 AM

The date subfunction of StrFormat is rather old. It has been intruduced with WinBuilder version 048.

It still works well. But recently there are some complains that it does not work.
Therefore this small tutorial.

The command is StrFormat,DATE,%var%[,<format>]
The optional <format> string defines how the date is displayed.
Below there is a list, how <format> can be composed.

IMPORTANT: if <format> contains spaces, it MUST be enclosed in quotes!

'TimeStamp': You can use <Format> yyyymmddhhnnsszzz. That will generate something like '20081219122430145'

Remark: I just changed to 'optional' in WB beta 5 J. If ',<format>' is not present, the local standard date is displayed.
e.g. USA: 12/19/2008
Germany: 19.12.2008

c_______Displays the date using the format given by the ShortDateFormat global variable, followed by the time using the formatgiven by the LongTimeFormat global variable. The time is not displayed if the date-time value indicates midnight precisely.d_______Displays the day as a number without a leading zero (1-31).dd______Displays the day as a number with a leading zero (01-31).ddd_____Displays the day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable.dddd____Displays the day as a full name (Sunday-Saturday) using the strings given by the LongDayNames global variable.ddddd___Displays the date using the format given by the ShortDateFormat global variable.dddddd__Displays the date using the format given by the LongDateFormat global variable.e_______(Windows only) Displays the year in the current period/era as a number without a leading zero (Japanese, Korean and Taiwanese locales only).ee______(Windows only) Displays the year in the current period/era as a number with a leading zero (Japanese, Korean and Taiwanese locales only).g_______(Windows only) Displays the period/era as an abbreviation (Japanese and Taiwanese locales only).gg______(Windows only) Displays the period/era as a full name. (Japanese and Taiwanese locales only).m_______Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.mm______Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.mmm_____Displays the month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.mmmm____Displays the month as a full name (January-December) using the strings given by the LongMonthNames global variable.yy______Displays the year as a two-digit number (00-99).yyyy____Displays the year as a four-digit number (0000-9999).h_______Displays the hour without a leading zero (0-23).hh______Displays the hour with a leading zero (00-23).n_______Displays the minute without a leading zero (0-59).nn______Displays the minute with a leading zero (00-59).s_______Displays the second without a leading zero (0-59).ss______Displays the second with a leading zero (00-59).z_______Displays the millisecond without a leading zero (0-999).zzz_____Displays the millisecond with a leading zero (000-999).t_______Displays the time using the format given by the ShortTimeFormat global variable.tt______Displays the time using the format given by the LongTimeFormat global variable.am/pm___Uses the 12-hour clock for the preceding h or hh specifier, and displays &#39;am&#39; for any hour before noon, and &#39;pm&#39; for any hour after noon.The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.a/p_____Uses the 12-hour clock for the preceding h or hh specifier, and displays &#39;a&#39; for any hour before noon, and &#39;p&#39; for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.ampm____Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the TimeAMString global variable for any hour before noon,  and the contents of the TimePMString global variable for any hour after noon./_______Displays the date separator character given by the DateSeparator global variable.:_______Displays the time separator character given by the TimeSeparator global variable.&#39;x&#39;/"x"_Characters enclosed in single or double quotes are displayed as-is, and do not affect formatting.

Sorry about the bad view!
I'm not able to write tabs or multiple spaces here.

Peter

#2 Lancelot

Lancelot

    Frequent Member

  • .script developer
  • 5013 posts
  • Location:Turkiye/Izmir
  • Interests:*Mechanical stuff and Physics,
    *LiveXP, BartPE, SherpyaXPE,
    *Basketball and Looong Walking,
    *Buying outwear for my girlf (Reason: Girls are stupid about buying bad stuff to make themselves uglier :))
    *Girls (Lyric: Girl,...., You will be a womann, Soon)
    *Answering questions for "Meaning of life",
    *Helping people,

    Kung with LiveXP, Fu with Peter :)
  •  
    Turkey

Posted 24 December 2008 - 02:04 AM

Thank you Peter,

I don't know how but i totally missed this topic :cheers:, just found now (Thanks to Nuno's weekly newsletter)

Everything works fine, all problems solved, thank you a lot for tutorial




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users