.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
ofdatetime
. these local, universal or unspecifieddatetime
values? should usedatetimeoffset
, 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 standardo
oro
format string produce iso-8601 strings.)
Comments
Post a Comment