Recognising and changing date format from US to AU - date

I'm fresh to R and I have a data frame that contains date in both US (%m/%d/%Y) and AU (%d/%m/%Y) format. Is there any function I could use to change formatting of US dates to AU? Thank you!

Related

NSDataDetection for Dates in Images with different Formats dependent of Locale?

I would like to convert a Date on an image to a Date type in Swift to store that data. I thought that I could use NSDataDetector for doing this, because I don't know the exact format which will occur on the image.
I had for example this Date: 01.08.2022 with the format: dd.mm.yyyy but if I use the NSDataDetector it was interpreted with the format mm.dd.yyyy
Is it possible to change that behavior so that the usual order of the numbers for the days and months for the region is used for interpretation?
Thanks for an answer

Calculating the date and time difference in libre office calc returns #VALUE

In libre office calc I got two cells with the following content:
2022.01.10 15:51:06
2022.01.10 16:14:22
When I substract one from the other I get #VALUE!
Both cells are formatted like this "JJJJ.MM.TT HH:MM:SS"
I tried different formats and also changing the format of the output cell, but I could not get it to work.
I want the difference in hours if possible.
Thank you very much in advance for your help!

LibreOffice : how shall I change the names of the weekdays in date format

In LibreOffice, I wish to change the weekdays names to have something shorter.
In French, the date format "ddd dd/mm/yy" applied to today 2021-08-17 gives : "mar. 17/08/21". I would prefer "ma 17/08/21" to have narrower columns.
So I wish to change the existing weekdays names "lun., mar., mer., jeu., even., sam., dim." to something shorter : "lu, ma, me, je, ve, sa, di", through the format used by LibreOffice.
I played with French locales (Swiss French, etc.) but it is not satisfactory. I tried to change the list for the sort but it has no effect on the date format.
Is it possible to change the list LibreOffice uses for the weekdays ? How shall I proceed ?
You cannot do this with normal formatting (unless you require a change to the national date standard).
However, you can easily get the desired date representation using the TEXTE() and REGEX() functions.
=REGEX(TEXT(A1;"OOO JJ/MM/AA");"(..)([^\.]*\.)(.+)";"$1$3";"g")
Or shorter notation using LEFT() (GAUCHE()):
=LEFT(TEXT(A1;"OOO");2)&TEXT(A1;"\ JJ/MM/AA")
Remember to check that the cell format is French, otherwise you will get an error (not every language uses O-J-A characters)

Converting string date to Human Readable Format HRF (Stata)

version: stata15
Date (format %9s), type 8s - 20171230
date
20171230
20171230
I want to be able to see 30dec2017,
gen newdate = date(date, "YMD")
format newdate %td
list
here is what I see
date newdate
20171230 .
Why do I see a missing data in the new date variable? what am I doing wrong in the newdate %td command ?
ANSWER TO ORIGINAL QUESTION:
This makes no obvious sense to me. Questions like this waste your time as well.
You don't give a clear reproducible example of your data. In a recent version of Stata, help dataex tells you how to do that. If you're using an older version of Stata then you should be telling us that.
Your first sentence seems to be telling us that you have a string variable date with storage type str8 and display format %9s.
If that is so, then tostring is pointless, as you already have a string variable.
The statement gen date = date(date, "YMD") is illegal, as date already exists as a variable. If you typed that, it will not have worked. If you typed something else, you should tell us.
The format %td should give you a fairly readable date. So, you've already answered your own question. If you have a numeric date variable, read help datetime display formats to learn more.
EDIT The fact that most of the above is irrelevant to the real question shows how you wasted time not asking the real question.
ANSWER TO MODIFIED QUESTION:
I can't reproduce your problem. You report a missing date result, and clearly no kind of display format will make sense of that. But Stata 15.1 does this for me. So, something is wrong with what you are telling us. Perhaps your Stata is corrupted, or something else is not as you say.
clear
set obs 1
gen str8 date = "20171230"
gen newdate = daily(date, "YMD")
list
+--------------------+
| date newdate |
|--------------------|
1. | 20171230 21183 |
+--------------------+
21183 will show nicely with a %td format. Using daily() rather than date() is irrelevant, as the same result is yielded by date().

Add a text to a cell after a date

I have placed the below formula in a cell which returns the date value -
"02/05/2015". 'Exception Report Register' is the name of the worksheet the formula pulls from and Q:Q the range.
=(VLOOKUP(9.99999999999999E+307,'Exception Report Register'!Q:Q,1))
I have then formatted the cell so the date will convert to "Saturday, 2 May 2015"
I want to add a full stop to the end to make it "Saturday, 2 May 2015."
I have tried:
=(VLOOKUP(9.99999999999999E+307,'Exception Report Register'!Q:Q,1))&"." which returns "42126." (as expected)
I have come across the below formula but not sure how to incorporate it
=TEXT(AJ24,"DD/MM/YYYY")&" "&"is Today"
Please help!
Cheers Mallory
Just want to clarify, this question is about formatting dates with the TEXT function in MS Excel.
If your date is in cell A1, try:
=TEXT(A1,"dddd, d mmm yyyy")&"."
You can substitute 'A1' with your (bizarre) vlookup function.
For more info on date formatting with the TEXT function, see the Guidelines for date and time formats section on MS Office Support website