Re: formatted date string
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Wed, 09 Apr 2008 23:11:22 -0700
Dave Cullen <nospam@xxxxxxxx> wrote:
I'm looking to get a 4 char date string from the system time in the form
WWYY. This week would be 1408.
According to MSDN this should work, except I only get the week (14) and
no year:
char date_code[]={0,0,0,0,0};
I'm just curious as to why you would write it that way, as opposed to, say:
char date_code[5];
If you are writing C++, you can use ATL to do this more safely:
CString date_code = CTime::GetCurrentTime().Format("%W%y");
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
.
Relevant Pages
- Re: How to add thousand separators
... First, this code is obsolete as written, because char is a dead data type and should not ... Note that both of these should be stored as string resources since they might need to be ... 18 digits for any reason. ... you have made a VERY SERIOUS DESIGN ERROR. ... (microsoft.public.vc.mfc) - Re: what is the best way of passing floats into a string
... I do not null-terminate as snprintf takes care of this (according to ... But the easiest way to determine the size needed to format a number, ... int length_of_representation(double n,const char* format){ ... I get a nice result of -10.000000 in my char * string. ... (comp.unix.programmer) - Re: weird problem
... I already told you that the comparison between an integer and a float ... to strcmpwhich expects a pointer to a string. ... And now a question about something else: why do you use floating ... int,float, char, etc. ... (comp.lang.c) - Re: why I can not write to the file after initialize the MFC in a service program
... you don't use char, an obsolete data type ... Why do you need an intermedate buffer to write literal strings anyway? ... For example, if AfxWinInit fails, you copy a 45-character string into a ... So you are going to try to initialize MFC EACH TIME THROUGH THE LOOP? ... (microsoft.public.vc.mfc) - Re: [OT] My First C# (warning - long post)
... cut me some slack - show me a COBOL program with less than 15 working-storage variables! ... Yes, the Trimis probably extra now, but that was my attempt to get it to quit griping at me that I had given it a "String", when it wanted a "char". ... public string IBreturn ... (comp.lang.cobol) |
|