views:

120

answers:

3

I'm currently passing some date-time info to a web page using url parameters, which are ticks of date times, and then converting the ticks back into date times when I need to at the other end.

Is there a better way to do this, and why.

for example

http://localhost:57765/dinners/updatedinner/38?startDate=633917664000000000

+1  A: 

that's fine, in fact that the standard format for encoding dates for JSON. only concern is timezones, as your tickcount doesn't encode that. you can either always assume the timzone, and do offset calculations based on that, or encode the timezone in the value (eg sD=12343245345-0500)

kolosy
A: 

Representing datetime in human readable format would be much better for developers (troubleshooting etc.) and potential customers of your site.

Vitaliy Liptchinsky
unless you deliberately do not want the parameter passed in the URL to be easily editable by a casual user. Then this could help the security of the site.
Carlton Jenke
But ticks are not a barrier for more-less advanced users.
Vitaliy Liptchinsky
No real security issues at this point in the app, and it's just a private variable to be used for one user, ie non public
optician
Then I'd use human-readable format
Vitaliy Liptchinsky
A: 

Given that Ticks is defined as the number of 100-nanosecond intervals that have passed since 12 midnight, January 1, 0001, I can't see there being any functional issues, as long as you either convert to UTC before passing (and from UTC after) or otherwise deal with timezone issues.

That said, there are more human-friendly ways to pass the information, for example passing it as yyyyMMddThhmmss.nnn will be more friendly if anyone wants to manually enter the URL, although it's not quite as precise (if you need better than millisecond precision).

technophile
Definatly don't need precision, I just liked the quickness of getting this up and running.
optician