R
Raj
Hi
I'm very new to C and am trying to get the time a month ago in the format
mmyy.
What I have tried so far is:
char *last_mth;
size_t maxsize = 4;
struct tm *timeptr = localtime(time(0));
strftime(last_mth, maxsize, "%m%y", timeptr);
to get the current mmyy, but I don't know how to access the tm struct so
that I can decrement the month.
I know this is the simplest of things to do, but I haven't found it in the
FAQ. If this is a silly request, please let me know. I'm off to look in
tutorials in case they can tell me there.
Thanks in advance for any help provided.
Regards,
--
Raj Kothary :: one|concept
http://www.oneconcept.net
(e-mail address removed)
+ 44 (0)79 5647 2746
oneconcept limited :: 17 York Avenue, Stanmore, Middlesex HA7 2HT
Confidentiality notice:
The information transmitted in this email and/or any attached document(s) is
confidential and intended only for the person or entity to which it is
addressed and may contain privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon this
information by persons or entities other than the intended recipient is
prohibited. If you received this in error, please contact the sender and
delete the material from any computer.
I'm very new to C and am trying to get the time a month ago in the format
mmyy.
What I have tried so far is:
char *last_mth;
size_t maxsize = 4;
struct tm *timeptr = localtime(time(0));
strftime(last_mth, maxsize, "%m%y", timeptr);
to get the current mmyy, but I don't know how to access the tm struct so
that I can decrement the month.
I know this is the simplest of things to do, but I haven't found it in the
FAQ. If this is a silly request, please let me know. I'm off to look in
tutorials in case they can tell me there.
Thanks in advance for any help provided.
Regards,
--
Raj Kothary :: one|concept
http://www.oneconcept.net
(e-mail address removed)
+ 44 (0)79 5647 2746
oneconcept limited :: 17 York Avenue, Stanmore, Middlesex HA7 2HT
Confidentiality notice:
The information transmitted in this email and/or any attached document(s) is
confidential and intended only for the person or entity to which it is
addressed and may contain privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon this
information by persons or entities other than the intended recipient is
prohibited. If you received this in error, please contact the sender and
delete the material from any computer.