.net - how to store c# datetime in text database field -


i have built dynamic form system, accepts types of textfields, dropdowns , datetimes.

the form answers dynamic, stored text, or text version of id dropdown answer.

for datetimes, want know best format serialise c# datetime text is, purely use seralisation. have , unix tics extension working, use javascript calls. feel there better option.

obviously datetime.parse used on way back, use on way out?

you'd use tostring appropriate standard or custom date/time format string.

however, need very careful this:

  • i'd suggest using cultureinfo.invariantculture perform conversion (and likewise when parsing) avoid culture-specific values
  • you need consider whether serialize kind of datetime. these local, universal or unspecified datetime values? should use datetimeoffset , serialize offset too?
  • what precision need?
  • what else reading data? "standard" format such iso-8601 might idea, potentially extended maintain same precision datetime itself. (the standard o or o format string produce iso-8601 strings.)

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -