CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Is posible to get the compilation date in DD-MM-YY format?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

Is posible to get the compilation date in DD-MM-YY format?
PostPosted: Thu Aug 03, 2023 11:17 pm     Reply with quote

I need to set a starting date until the GPS get the date; I've been using the __date__ pre-processor identifier but the month is in text format, I need a number.

Any way to get the date in numeric format?
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19232

View user's profile Send private message

PostPosted: Fri Aug 04, 2023 3:19 am     Reply with quote

You'd just have to have your code extract the number from the string.
Extract the 3 character month name, and do a search through a constant
array of month names to find the one that matches.
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

PostPosted: Fri Aug 04, 2023 9:14 am     Reply with quote

Is always the 3 first letters from each month?
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19232

View user's profile Send private message

PostPosted: Fri Aug 04, 2023 11:41 am     Reply with quote

Yes, and always in the same positions.
temtronic



Joined: 01 Jul 2010
Posts: 9118
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Aug 04, 2023 5:24 pm     Reply with quote

I've always used the yy-mm-dd format.
That way I can't confuse 4th of May with April the 5th......
PrinceNai



Joined: 31 Oct 2016
Posts: 454
Location: Montenegro

View user's profile Send private message

PostPosted: Fri Aug 04, 2023 6:09 pm     Reply with quote

Well, we all had our share with different notations. For fun, try those:

https://xkcd.com/2562/
https://xkcd.com/1179/
temtronic



Joined: 01 Jul 2010
Posts: 9118
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Aug 04, 2023 8:01 pm     Reply with quote

glad I'm not the only one that gets confused ! Actually it was a real problem with the business taxes...some vendors did mm/dd/yy other dd/mm/yy so when your 'fiscal' is in May, it was a challenge to get the proper receipts. Had to get the feds to OK changing my business fiscal to the 'calendar' fiscal.

Now, at 70, it's what day of the week is it ????? With stores open 7 days a week, retired for 35 years, sigh...
It took me couple months to HACK into Windows10 to get the 'time' in lower right corner to display the Day Of the Week(it is NOT and option.....)
Ttelmah



Joined: 11 Mar 2010
Posts: 19232

View user's profile Send private message

PostPosted: Mon Aug 07, 2023 1:32 am     Reply with quote

Fortunately, here this is not a problem.
The date string has the month as characters 4 to 6.
A basic code to get the 'month number', wuld be something like:
Code:

   const char months[12][4]={ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
   char string_date[]=__date__;
   int month_num;
   for (month_num=0;month_num<12;month_num++)
      if (strncmp(string_date+3,months[month_num],3)==0)
         break;
   month_num++; //month_num is now the compile month


You'd need PASS_STRINGS=IN_RAM for this, since otherwise you can't
pass the constant month names as a pointer.
Ttelmah



Joined: 11 Mar 2010
Posts: 19232

View user's profile Send private message

PostPosted: Mon Aug 07, 2023 1:53 am     Reply with quote

Jay, actually DOW, is available in the taskbar. No hack needed.
Control Panel.
Date & Time.
Change Date & Time.
Change calendar settings.
Formats.
Additional settings
Date tab
Then in the short date tab, type ddd/ in front of the entry.
OK

Voila. Smile

It is 'non obvious;, but basically this tab allows you to customise the
date and time format, and the ddd entry adds the day of the week to
this.
Classic Microsoft having the setting, but not telling you how to get it!....
temtronic



Joined: 01 Jul 2010
Posts: 9118
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Aug 07, 2023 6:07 am     Reply with quote

sigh ddd ???
yeesh DOW makes more sense to me....
egads, I'm old AND cranky !

now, just HOW can I reprogram the wife's NISSAN car 'radio' to NOT come on at the ear shattering VOLUME it was on when she last turned off the car ?
actually kinda curious if any other cars are the same ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19232

View user's profile Send private message

PostPosted: Mon Aug 07, 2023 6:18 am     Reply with quote

Depends on the model.
Some Nissan's have a setting called 'speed volume', which makes the
volume turn up at speed. Stupid thing is that if this is enabled, it'll
wake up at full volume when you first switch it on, and then turn down once
you drive. This might be what you are seeing. It is an option. Set to 0 to
disable. Some do have an audio preset that sets the default wake up
volume.
Ttelmah



Joined: 11 Mar 2010
Posts: 19232

View user's profile Send private message

PostPosted: Mon Aug 07, 2023 6:29 am     Reply with quote

On DOW, versus ddd, I think MS wanted to keep the number of letters
involved in the formats as low as possible. You also have to remember this
is an international setting. DOW, is a very 'English only' format.
They use:

d day of month 1..31
dd day of month 01...31
ddd day of week (Mon etc.)
dddd day of week (full format Monday etc.)
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group