Dear members,
Is it possible with FormatTime to add an inputdate like: 31.01.2022 (this is how Germans write a date) to this outputdate: YYYYMMDD ?
I have no clue how to do that. Can somebody please help me on my way with it?
Thanks in advance!
Is it possible to convert a German date? Topic is solved
Re: Is it possible to convert a German date? Topic is solved
Code: Select all
d := StrSplit("31.01.2022",".")
MsgBox % d.3 d.2 d.1
-
- Posts: 67
- Joined: 23 May 2022, 01:17
Re: Is it possible to convert a German date?
@bobo wow that simple! Thank you very much!
Re: Is it possible to convert a German date?
Hallo,
my method to calculate dates with known TimeStamps:
my method to calculate dates with known TimeStamps:
Code: Select all
GTimeStamp = dd.MM.yyyy ;Germans write a date
MsgBox,% Date := TimeStamp("31.01.2022",GTimeStamp)
; 20220131120000 (Noon if time not given)
Date += 1234, days ;EnvAdd
FormatTime, Date,% Date, %GTimeStamp%
MsgBox,% Date ;18.06.2025 = 31.01.2022 + 1234 days
TimeStamp(Date, Format:="")
{
Static Noon := A_Year A_MM A_DD 120000, Down := 7060504030201, FOld
FormatTime, D,% 8 Down,% Format?FOld:=Trim(Format):FOld
For all, V in ["Date","D"], Date := Trim(Date) ; add missing leading zeros
%V% := RegExReplace(%V%, "(?<=^|\D)(\d)(?=\D|$)", "0$1")
Loop, Parse,% (0 Down, N := Noon) ; today's noon
IF A_LoopField And Pos := InStr(D, A_LoopField)
N := SubStr(N,1,A_Index-2) SubStr(Date,Pos-1,2) SubStr(N,A_Index+1)
Return, N ; digits >0 from Down in D stand for Date's values
}
-
- Posts: 67
- Joined: 23 May 2022, 01:17
Re: Is it possible to convert a German date?
Danke auch! @Rohwedder