ctime format

Discussion in 'C++' started by Gary Wessle, Feb 1, 2007.

  1. Gary Wessle

    Gary Wessle Guest

    Hello

    I have been playing around all day on how to convert a time epoch to a
    string in the format of my choice.

    ctime puts out Thu Feb 1 18:32:14 2007
    but I want 2007-2-1 18:32:14

    any ideas, I tried with boost but it is an overkill.
    // date_input_facet* inf = new date_input_facet();
    // f->format("%a %b %d %H:%M:%S %Y"); // file:///usr/share/doc/boost-1.33.1/date_time/date_time_io.html
    // date_output_facet* outf = new

    then got stuck.

    thanks
     
    Gary Wessle, Feb 1, 2007
    #1
    1. Advertising

  2. Gary Wessle

    Guest

    > I have been playing around all day on how to convert a time epoch to a
    > string in the format of my choice.

    Have a look at strftime().
    m
     
    , Feb 1, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ernst Murnleitner

    replacement for <ctime>?

    Ernst Murnleitner, Jul 16, 2003, in forum: C++
    Replies:
    8
    Views:
    539
    Limech
    Jul 20, 2003
  2. Tivo Escobar

    Question about ctime

    Tivo Escobar, Jul 23, 2003, in forum: C++
    Replies:
    1
    Views:
    398
    Victor Bazarov
    Jul 23, 2003
  3. Oplec
    Replies:
    2
    Views:
    520
    Oplec
    Oct 26, 2003
  4. Kevin

    ctime Help

    Kevin, May 16, 2004, in forum: C++
    Replies:
    3
    Views:
    794
    osmium
    May 16, 2004
  5. wukexin
    Replies:
    1
    Views:
    477
    Karl Heinz Buchegger
    May 25, 2005
Loading...

Share This Page