3

An Italian provider in his webservice documentation defines a date (birthDate) as string. Why ?
I discovered the format provided is d-m-Y, my database store it as Y-m-d and my users prefer d/m/Y (as many Italians).

Comments
  • 12
    ISO format is the only real format: YYYY-MM-DD.

    You can sort ISO format as strings and it just works!
  • 2
    If the transfer format serializes dates to strings (e.g. JSON) string probably is the only valid type for a date.
    The alternative would be integer when storing the unix timestamp.
  • 1
    @sbiewald works if you're born after Jan 1 1970.
  • 0
    Hold on, are you telling me people still uses Date, Time, String or any kind to express a date which is not a fucking LONG number!!!????

    Jesus freaking Christ, what are you? animals?
  • 0
    @olback Negative numbers?
  • 1
    @arcioneo so you haven't dealt with 1969 before?

    DateTime is generally a string

    YYYY-MM-DD HH:MM:SS
    OR
    YYYY-MM-DDTHH:MM:SSZ

    Unless it's Unix time stamp (int)
    But then you may end up with the 1969 issue of hitting a negative value.

    The format can change but it's usually the same.
  • 0
    ISO-8601 is your friend.
Add Comment