Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

cannot format date

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    cannot format date

    i cannot seem to change the format of the string coming from the Time object.
    string myInsertQuery = String.Format("insert into scans_logs (symbol, datetime,message) values ('{0}','{1:u}','{2}')",Instrument.FullName,Time,st r);

    i am expecting a datetime format like

    "2008-03-09 16:05:07Z"

    but i keep getting a dateformat like
    '2009-05-31 22:05:00 PM',

    how do i avoid getting the PM from the dateformat.
    ref:

    #2
    junkone, you can check the DateTime class member methods for conversion options for this - http://msdn.microsoft.com/en-us/libr...rs(VS.80).aspx

    Comment


      #3
      i can easily convert the datetime object to any format i want. i just cannot convert the Time object. I am not sure why?

      Comment


        #4
        Time is a DateTime object, you try formatting it as a String with String.Format

        Comment


          #5
          if you look at post # 1, thats excactly that i am trying and it fails to format correctly.
          when i use a regular DateTime.now , it works. so i am not sure why the Time object is not able to be string formatted.

          Comment


            #6
            I compared both DateTime.Now and Time[0] on my end and they both return a DateTime object as expected.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            169 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            324 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            250 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            351 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            180 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X