473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

ctime format

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
Feb 1 '07 #1
1 5826
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 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kevin | last post by:
Hello: I am trying to find documentation on using the ctime library as I need to be able to instantiate an object to keep track of the time when a certain event occurs. I also need to be able...
1
by: wukexin | last post by:
I write my own class Cfile, I want to know what about implement ctime().Who help me? My use function ctime, I sign it with $$$. my class Cfile: #------------------------ file.h...
5
by: berkay | last post by:
long num,num1; char *first; char *last; num=ilk.getTime();//gets time first=ctime(&num); cout.flush(); fflush(stdin); 1) cout<<"first:"<<first;
2
by: Hao Xu | last post by:
Hi everyone! I think that everyone knows ctime() in glibc: The ctime(), gmtime() and localtime() functions all take an argument of data type time_t which represents calendar time. When ...
2
by: Chris | last post by:
Hello, How can i convert a C++ CTime (4 bytes) into a C# DateTime ? (my CTime is read in a file). Thanks, -- Chris
4
by: Gary Wessle | last post by:
Hi I am not getting current time with this program, what am I doing wrong? #include <ctime> #include <iostream> using namespace std; #define P(x) cout << #x " = " << (x) << "\n";
11
by: aisling.cronin | last post by:
Hi I am using ctime to convert the following string 1144412677847 .... Please could some one to double check if they get the same result as me (The Time is Sun Nov 02 09:11:51 2031). It seems...
4
by: Pietro Cerutti | last post by:
Hi group, #include <stdio.h> #include <unistd.h> #include <time.h> int main(void) { time_t t1, t2; char *st1, *st2;
9
by: Lars Uffmann | last post by:
Is the ctime library really that poorly designed, or is it just me looking to do things the wrong way? The whole concept of the struct tm seems way too highlevel for my taste - this is something...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.