How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mysystem
Posts: 9
Joined: 25 Oct 2021 07:00

How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#1 Post by Mysystem » 25 Oct 2021 07:08

hi
How to change Windows date from Gregorian date to Umm Al-Qura date
Via batch file how that?? :!: :?:

Aacini
Expert
Posts: 1885
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#2 Post by Aacini » 25 Oct 2021 07:44

Hi, welcome to this forum. This is an advice for you:

- In first place, be patient. The people in this forum are not here to review new posts and reply they ASAP. Give some hours, or even days, for a reply.
- If you are new to this forum you should wait until a moderator approve your first post.
- You should give enough info to help others to help you. Many of us don't know what Umm al-Qura Calendar is, so you should give info links to such a topic. If you want to implement a conversion method in a Batch file, what are the rules for such a conversion?
- You should be very precise in your requests. For example, in what dates range you want the conversion? From 1392 AH to 1419 AH? After 15 March 2002 of Julian Calendar? I strongly suggest you to read the first topic on this forum before post any new question/reply here.

Antonio


aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#4 Post by aGerman » 25 Oct 2021 13:47

.NET implements the "UmAlQuraCalendar" class which can be used in a little PowerShell hybrid.

Batch code:

Code: Select all

@echo off &setlocal

:: Year, Month, and Day in the Gregorian Calendar
set /a "gregY=2021, gregM=10, gregD=25"

:: Use the .NET "UmAlQuraCalendar" class in a PowerShell command to convert the date
for /f "tokens=1-3" %%i in (
  'powershell.exe -nop -ep Bypass -c "$DT=New-Object DateTime(%gregY%,%gregM%,%gregD%);$UAQ=New-Object Globalization.UmAlQuraCalendar;(''+$UAQ.GetYear($DT)+' '+$UAQ.GetMonth($DT)+' '+$UAQ.GetDayOfMonth($DT))"'
) do set /a "uaqY=%%i, uaqM=%%j, uaqD=%%k"

:: Year, Month, and Day in the Umm Al-Qura Calendar
echo Year  %uaqY%
echo Month %uaqM%
echo Day   %uaqD%

pause
Steffen

Mysystem
Posts: 9
Joined: 25 Oct 2021 07:00

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#5 Post by Mysystem » 26 Oct 2021 08:23

Thank you, but the question was, how do I change the Windows date from the Gregorian date to the date of Umm Al-Qura through a batch file, how is that??

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#6 Post by aGerman » 26 Oct 2021 08:32

Could you rephrase your question please? You just repeated your origininal question, but I still don't understand what you are looking for. Sorry.

Steffen


Mysystem
Posts: 9
Joined: 25 Oct 2021 07:00

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#8 Post by Mysystem » 26 Oct 2021 23:34

hi
oh gentlemen

The question is, how do I change the Windows date from the Gregorian date to the Umm Al-Qura date through a batch file code, how is that?? :idea:

atfon
Posts: 178
Joined: 06 Oct 2017 07:33

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#9 Post by atfon » 27 Oct 2021 05:52

Mysystem wrote:
26 Oct 2021 23:34
hi
oh gentlemen

The question is, how do I change the Windows date from the Gregorian date to the Umm Al-Qura date through a batch file code, how is that?? :idea:
Are you looking to change the date on the Windows operating system, use a method to convert a date or something else? Unless you can re-phrase the question, the people on this forum will have a hard time assisting you. Is there any code you have tried or resources you have checked?

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

#10 Post by Squashman » 27 Oct 2021 07:59

Mysystem wrote:
26 Oct 2021 23:34
hi
oh gentlemen

The question is, how do I change the Windows date from the Gregorian date to the Umm Al-Qura date through a batch file code, how is that?? :idea:
You are literally just repeating yourself over and over with no new additional information to clarify your question. You were given code two days ago that does what you ask for. If that code is not working or is not what you expected then please explain how it does not work for you. I did verify the code that was posted by user aGerman. If you cannot provide any additional feedback I will just close your question and you can move onto some other computer forum to ask your question.

Post Reply