Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to send Date as a DateTime Object?.

How to send Date as a DateTime Object?.

Scheduled Pinned Locked Moved C#
questiontutorial
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pubududilena
    wrote on last edited by
    #1

    Hi, I need to send startDate to a Service like following format.But I need to send it as a DateTime Object NOT like string format.So How do I send following Date with DateTime Object? 2007-07-29T00:00:00.0000000+05:30 Please kindly reply me. Thanks in advance.

    M D 2 Replies Last reply
    0
    • P pubududilena

      Hi, I need to send startDate to a Service like following format.But I need to send it as a DateTime Object NOT like string format.So How do I send following Date with DateTime Object? 2007-07-29T00:00:00.0000000+05:30 Please kindly reply me. Thanks in advance.

      M Offline
      M Offline
      Manoj Kumar Rai
      wrote on last edited by
      #2

      Hi, DateTime is a serializable class, and there is no issue sending it to the Services like "Remoting" server as a parameter of a interface function call. Also, if you are trying to send it to the other service which has been written using C#, you can serialize the DateTime object and send it as "byte" data, and get it deserialized at the sever end.

      Manoj Never Give up

      P 1 Reply Last reply
      0
      • M Manoj Kumar Rai

        Hi, DateTime is a serializable class, and there is no issue sending it to the Services like "Remoting" server as a parameter of a interface function call. Also, if you are trying to send it to the other service which has been written using C#, you can serialize the DateTime object and send it as "byte" data, and get it deserialized at the sever end.

        Manoj Never Give up

        P Offline
        P Offline
        pubududilena
        wrote on last edited by
        #3

        Hi, Thanks for reply. But in my XML Web Service,There is a DateTime Property called "StartDate". So I need to send following format to there as a DateTime object. 2007-07-29T00:00:00.0000000+05:30 Problem is how can I send +05:30 with the DateTime object?. Thanks in advance

        M 1 Reply Last reply
        0
        • P pubududilena

          Hi, Thanks for reply. But in my XML Web Service,There is a DateTime Property called "StartDate". So I need to send following format to there as a DateTime object. 2007-07-29T00:00:00.0000000+05:30 Problem is how can I send +05:30 with the DateTime object?. Thanks in advance

          M Offline
          M Offline
          Manoj Kumar Rai
          wrote on last edited by
          #4

          why dont you use one more parameter for the Time Zone value.

          Manoj Never Give up

          P 1 Reply Last reply
          0
          • M Manoj Kumar Rai

            why dont you use one more parameter for the Time Zone value.

            Manoj Never Give up

            P Offline
            P Offline
            pubududilena
            wrote on last edited by
            #5

            hi, We are unable to change the xml webservice.We can send request to service and take response. In the Request we need to send StartDate with Time Zone. Thanks in advance.

            1 Reply Last reply
            0
            • P pubududilena

              Hi, I need to send startDate to a Service like following format.But I need to send it as a DateTime Object NOT like string format.So How do I send following Date with DateTime Object? 2007-07-29T00:00:00.0000000+05:30 Please kindly reply me. Thanks in advance.

              D Offline
              D Offline
              DoomedOne
              wrote on last edited by
              #6

              Maybe this helps string dateformat; TimeZone localZone = TimeZone.CurrentTimeZone; dateformat = DateTime.Now.ToString("yyyy-MM-dd") + "T" DateTime.Now.TimeOfDay.ToString() + localZone.GetUtcOffset(DateTime.Now); dateformat gets somting like: "2007-05-21T18:26:24.8906250-03:00:00" you may need to cut the last ":00". Replace de DateTime.Now for the DateTime Object you need to send.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups