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 / C++ / MFC
  4. OLEDB + Date [modified]

OLEDB + Date [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 2 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.
  • T Offline
    T Offline
    Try
    wrote on last edited by
    #1

    Hi everyone, I am using OLEDB APIs (such as CTable, CDynamicAccessor etc) for retrieving data from a text file (say abc.txt). The problem is while retrieving date value. When date in "Regional and Language Options in Control Panel" is "M/d/yyyy" format, GetValue of CDynamicAccessor returns correct date value. If i change date format to "d/M/yyyy", GetValue returns NULL. Can anyone tell me the reason for this behaviour? Thanks -- modified at 3:17 Monday 9th July, 2007

    S 1 Reply Last reply
    0
    • T Try

      Hi everyone, I am using OLEDB APIs (such as CTable, CDynamicAccessor etc) for retrieving data from a text file (say abc.txt). The problem is while retrieving date value. When date in "Regional and Language Options in Control Panel" is "M/d/yyyy" format, GetValue of CDynamicAccessor returns correct date value. If i change date format to "d/M/yyyy", GetValue returns NULL. Can anyone tell me the reason for this behaviour? Thanks -- modified at 3:17 Monday 9th July, 2007

      S Offline
      S Offline
      Steve S
      wrote on last edited by
      #2

      What format is the date value inside the text file? The problem recognising D/M/Y versus M/D/Y is that there are a large number of values (where both M and D are <= 12) where it cannot be categorically determined which format is in use. If the data driver you are using is expecting M/d/yyyy, then in theory you could call SetThreadLocale() while you do the retrieval, and set it back again afterwards, but there's no guarantee that it isn't using LOCALE_SYSTEM_DEFAULT or LOCALE_USER_DEFAULT, rather than calling GetThreadLocale() internally.

      Steve S Developer for hire

      T 1 Reply Last reply
      0
      • S Steve S

        What format is the date value inside the text file? The problem recognising D/M/Y versus M/D/Y is that there are a large number of values (where both M and D are <= 12) where it cannot be categorically determined which format is in use. If the data driver you are using is expecting M/d/yyyy, then in theory you could call SetThreadLocale() while you do the retrieval, and set it back again afterwards, but there's no guarantee that it isn't using LOCALE_SYSTEM_DEFAULT or LOCALE_USER_DEFAULT, rather than calling GetThreadLocale() internally.

        Steve S Developer for hire

        T Offline
        T Offline
        Try
        wrote on last edited by
        #3

        Steve S wrote:

        What format is the date value inside the text file?

        "M/d/yyyy" format Any solution??

        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