on 2025 Mar 14 10:00 AM
Hi everyone,
I would like to get the current date time of specific time zone (eg. AU time zone) in the BPA.
I used new Date() and it gets as GMT +0 time zone.
How can I convert to AU time zone?
Best Regards,
Aye Chan
Request clarification before answering.
Hello AyeChan,
To convert the current date and time to a specific time zone in SAP Build Process Automation, you can use JavaScript within a custom script or the Expression Editor. Here is a step-by-step guide:
Get the Current Date and Time: Use new Date() to get the current date and time in GMT +0.
var currentDate = new Date();
Convert to Specific Time Zone: To convert the date and time to a specific time zone, you can use the toLocaleString method with the appropriate IANA time zone identifier. For example, to convert to Australian Western Standard Time (AWST):
var options = { timeZone: 'Australia/Perth', hour12: false }; var auDate = currentDate.toLocaleString('en-US', options);
Example Script: Here is a complete example script to convert the current date and time to the Australian Western Standard Time (AWST):
var currentDate = new Date(); var options = { timeZone: 'Australia/Perth', hour12: false }; var auDate = currentDate.toLocaleString('en-US', options); console.log(auDate); // Output the converted date and time
If you prefer using the Expression Editor in SAP Build Process Automation, you can enter the following expression:
new Date().toLocaleString('en-US', { timeZone: 'Australia/Perth', hour12: false })
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sankara1,
Thanks for your answer.
User | Count |
---|---|
92 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.