Extended FormatDate()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Extended FormatDate()

Post by Flype »

what about an extension for the FormatDate() mask ?

%day and %month are welcome.

Code: Select all

Procedure.s FormatDateEx(mask.s, date.l)
  
  Protected days.s   = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"
  Protected months.s = "January,February,March,April,May,June,July,August,September,October,November,December"
  
  mask = ReplaceString(mask, "%day",   StringField(days, DayOfWeek(date) + 1, ","))
  mask = ReplaceString(mask, "%month", StringField(months, Month(date), ","))
  
  ProcedureReturn FormatDate(mask, date)
  
EndProcedure
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Post by Dr. Dri »

and what about an optional Locale param ???

Dri
Post Reply