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 Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            647 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X