0

Is there a way of converting UTC seconds to a String with this format: dd/mm/yyyy hh:mm:ss?

D. Caan
  • 1,907
  • 6
  • 22
  • 36
  • Side note: You *ought* to use `yyyy-mm-dd hh:mm:ss` as a datetime format. – Tomalak Jul 11 '14 at 15:35
  • Because it's universally recognizable, unambiguous and it sorts properly. For a *technical* representation of a date (i.e. storage and processing) every alternative representation is inferior to this one. For a purely *visual* representation, other formats (i.e. what users commonly expect) are ok. Relevant XKCD http://xkcd.com/1179/ – Tomalak Jul 11 '14 at 15:41
  • @Tomalak I agree with you. In this case, it's purely visualisation. For sorting etc yyyy-mm-dd hh:mm:ss is a better format indeed. – D. Caan Jul 11 '14 at 15:43
  • 2
    `2014-07-11` is unabmiguously the 11th of July 2014, but some people could mistake `11/07/2014` for the 7th of November instead. `dd/mm/yyyy` is fine if you know all your readers are Europeans but if you have a mix of UK and US readers then `yyyy-mm-dd` is safer. – Ian Roberts Jul 11 '14 at 15:47

1 Answers1

2

Not natively in XPath 1.0, you'd need to use an appropriate extension function. How (indeed whether) you can do this depends what library/language/tool you're using to evaluate the XPath expressions.

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183