Thread: access timestamp

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    19

    access timestamp

    hi guys

    I am writing some data to my database and i want to sort it by date/time so i need to put a timestamp on my entries.

    I have coded this right now

    Code:
    str.Format("UPDATE webcapsdeployment SET Build='%s',Date2='%s', Dbweek='%s', Employe='%s', Comments='%s', 
    Timestamp='now()'  WHERE Platform = 'SAND'",m_sSandBuild, m_sSandDate, m_sSandDbweek, m_sSandEmploye, m_sSandComments);
    db.ExecuteSQL(str);
    i know that the timestamp is wrong but can someone make it right for me ?
    Last edited by Jalabert; 06-02-2005 at 02:15 AM.

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    6
    This link provides information about getting the time, it uses MFC. As I am familiar with neither MFC nor time and date functions, I cannot explain. The article is very specific however, and will hopefully be what you are looking for. not to mention its about 1 or 2 lines of code, depending on your coding style.

    http://msdn.microsoft.com/library/de...rrent_time.asp
    Last edited by CuLtOfGoAt; 06-02-2005 at 02:23 AM.

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I think your statement may be right if you remove the apostrophes around now().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. access to devices
    By pastitprogram in forum C++ Programming
    Replies: 1
    Last Post: 06-06-2008, 11:16 PM
  2. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  3. Order of access labels in class definition
    By Mario F. in forum C++ Programming
    Replies: 10
    Last Post: 06-16-2006, 07:13 AM
  4. Replies: 3
    Last Post: 09-22-2003, 09:48 PM
  5. Direct disk access in DOS
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-26-2002, 02:52 PM