Re: Time in format HHMMSS.D



On Thu, Dec 03, 2009 at 07:08:10PM +0100, Glus Xof wrote:
> Hi guys,
> 
> Getting date in YYYYMMDD format, have been easy for me using
> Glib::Date::format_string(), but I don't guess how could get the time
> in HHMMSS.D format. Is it possible ?

It's possible, but I don't know if I'm doing something wrong, because I have tried it out the last days 
several times in different ways, and it doesn't work for me.

An example:

#include <iostream>
#include <glibmm.h>

int main ()
{
        Glib::Date d1,d2;
        d1.clear();

        d1.set_time_current ();

        std::cout << "Date: " << d1.format_string("%y/%m/%d") << std::endl;
        std::cout << "Time: " << d1.format_string("%H:%M:%S") << std::endl;
        return 0;
}

ga ono-sendai:~/Proiektuak$ g++ gdate1.cc -o gdate `pkg-config --cflags --libs glibmm-2.4` 
ga ono-sendai:~/Proiektuak$ ./gdate 
Date: 09/12/04
Time: 00:00:00
ga ono-sendai:~/Proiektuak$ date
vie dic  4 00:18:54 CET 2009
ga ono-sendai:~/Proiektuak$

The unique modifier which works for me is %I, to get the hour.
I hope someone can help us here.

Regards.
> 
> I just look it up
> http://library.gnome.org/devel/glibmm/stable/structGlib_1_1TimeVal.html
> ...
> 
> Could you suggest anything ?
> 
> Glus.
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]