• 0

[C#] DateTime changes when passed to a web service


Question

When I pass a date time object (via serialization) to the server web service, it converts it to have an offset that matches the servers time. Is there a way to force it to just keep the local time

as it's being converted. I don't care about the time zones, I just care about the clients local time and their time only. The client uploads a file and the database stores their local machine time with it,

not the servers. The servers machine time will NEVER matter in this solution. So if it's 7 PM EST I don't want it being sent then converted to 4 PM PST when the web service reads it.

5 answers to this question

Recommended Posts

  • 0

UtcNow just returns the current utc time though. That won't help me convert the existing db rows of datetime to utc, so how would that work?

Ex:

FileSvcDef fileDef = request.FileSvcDefLst[i]; // <------------------- this has a datetime property that I passed via a web service and once it hits the server changes the timezone 3 hours back.
lastSyncDate = (DateTime)mReader["file_last_sync"]; // This is the right time coming straight from the database.
FileSvcSyncDef fileSyncDef = new FileSvcSyncDef(fileDef.GameId, -1, fileDef.FileName, (DateTime)lastSyncDate, fileDef.DirPath, SyncLocation.Server);

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • LAV Filters 0.82.0 by Razvan Serea LAVFSplitter is a multi-format media splitter that uses libavformat (the demuxing library from ffmpeg) to demux all sorts of media files. LAV Splitter is a Souce Filter/Splitter required to demux the files into their separate elementary streams. LAV Audio and Video Decoder are powerful decoders with a focus on quality and performance, without any compromises. Supported Formats: MKV/WebM, AVI, MP4/MOV, MPEG-TS/PS (including basic EVO support), FLV, OGG, and many more that are supported by ffmpeg! LAV Filters are based on ffmpeg and libbluray and is aimed to offer a all-around solution to perfect playback of file-based Media as well as Blu-rays. LAV Filters 0.82.0 changelog: LAV Splitter NEW: Support for demuxing Dolby Vision Enhancement Layer streams NEW: Support for Animated WebP images Changed: When demuxing Blu-ray discs, Dolby Vision metadata is available on the primary video stream LAV Video NEW: Support for Animated WebP images Changed: Hardware decoding support for DVDs has been removed Download: LAV Filters 0.82.0 | 15.5 MB (Open Source) View: LAV Filters Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • For some reason when EU forced Microsoft to allow users to change the default browser and search provider in Windows (also no ads for Office and the likes) - it was good. But when it comes to Apple - then it's bad. BTW, Apple would have gone out of business if Microsoft wasn't pressed by US government several decades ago. 😉
    • I understand Microsoft's intention here, at least I think I do. There have been so many printer driver related problems over the years due to OEM printer drivers not be compatible with the latest Windows update, that Microsoft wants to eliminate those by controlling the printer driver updates and keeping them compatible with the latest Windows update. That is okay as far it goes, but what it can do is put limitations on printers that wouldn't be there with OEM drivers since the OEM printer drivers are not universal drivers. It's a tradeoff and one can only hope it doesn't turn all Windows printers into $69 Brother printers.
  • Recent Achievements

    • One Month Later
      Sopa flores earned a badge
      One Month Later
    • First Post
      StaticMatrix earned a badge
      First Post
    • Week One Done
      StaticMatrix earned a badge
      Week One Done
    • Rookie
      lamborghiniv10 went up a rank
      Rookie
    • One Month Later
      pinnclepd earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      PsYcHoKiLLa
      207
    3. 3
      +Edouard
      156
    4. 4
      Steven P.
      87
    5. 5
      ATLien_0
      79
  • Tell a friend

    Love Neowin? Tell a friend!