Code: Select all
day. month. year
Code: Select all
2. 8. 2022 (note two spaces)
Code: Select all
%d
%m
Edit: looks like we are not the only one: https://en.wikipedia.org/wiki/Date_format_by_country
Thanks.
Saso
Code: Select all
day. month. year
Code: Select all
2. 8. 2022 (note two spaces)
Code: Select all
%d
%m
Code: Select all
Procedure.s MyFormatDate (mask$, date.i=-1)
; in : mask$: can contain the same tokens as used with PB's FormatDate(),
; plus the following additional ones:
; - %d --> day number without leading "0"
; - %m --> month number without leading "0"
; date : date value in PB's format; -1 for current system date and time
; out: mask string with all tokens replaced by the respective date values
If date = -1
date = Date()
EndIf
mask$ = FormatDate(mask$, date)
mask$ = ReplaceString(mask$, "%d", Str(Day(date)))
mask$ = ReplaceString(mask$, "%m", Str(Month(date)))
ProcedureReturn mask$
EndProcedure
Debug MyFormatDate("%d. %m. %yyyy")
Code: Select all
mydate$ = FormatDate(" %dd. %mm. %yyyy",Date())
mydate$ = ReplaceString(mydate$," 0"," ")
Debug mydate$
; all in one line with leading space removed if present
mydate$ = Trim(ReplaceString(FormatDate(" %dd. %mm. %yyyy",Date())," 0"," "))
Debug mydate$