Is it advisable / good programming practice to store date formats as string constants which can then be used throughout a web application?
For instance, instead of writing .ToString("dd.MM.yyyy") in code-behind, one would use .ToString(MyDateClass.DateFormat1). If .ToString("yyyy.MM.dd") is used elsewhere, we would create MyDateClass.DateFormat2 and use .ToString(MyDateClass.DateFormat2).
For JS code one could for instance have global string variables for "dd.MM.yyyy" and "yyyy.MM.dd" and these will be used instead.
Aucun commentaire:
Enregistrer un commentaire