View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
Is posible to get the compilation date in DD-MM-YY format? |
Posted: Thu Aug 03, 2023 11:17 pm |
|
|
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: 19538
|
|
Posted: Fri Aug 04, 2023 3:19 am |
|
|
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
|
|
Posted: Fri Aug 04, 2023 9:14 am |
|
|
Is always the 3 first letters from each month? _________________ Electric Blue |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Fri Aug 04, 2023 11:41 am |
|
|
Yes, and always in the same positions. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Fri Aug 04, 2023 5:24 pm |
|
|
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: 480 Location: Montenegro
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Fri Aug 04, 2023 8:01 pm |
|
|
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: 19538
|
|
Posted: Mon Aug 07, 2023 1:32 am |
|
|
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: 19538
|
|
Posted: Mon Aug 07, 2023 1:53 am |
|
|
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.
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: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Aug 07, 2023 6:07 am |
|
|
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: 19538
|
|
Posted: Mon Aug 07, 2023 6:18 am |
|
|
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: 19538
|
|
Posted: Mon Aug 07, 2023 6:29 am |
|
|
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.) |
|
|
|