Hi All,
I´m trying to create the current Date and Time within a script node and assign it both date and time to dfferent variables.
For Date I want to get the following format: dd.MM.yyyy
For Time I want to get the following format: HH:mm
Actually there are many methods to get the current Date and Time. Let me give you a simple example:
import java.text.SimpleDateFormat;
Date currentTimeStamp = new java.util.Date()
String date = new SimpleDateFormat("dd.MM.yyyy").format(currentTimeStamp)
String time = new SimpleDateFormat("HH:mm").format(currentTimeStamp)
this will give you the current date in dd.MM.yyyy format and time in HH:mm in current time zone.
if you need a specific time zone, you need to modify it a bit in this way:
import java.text.SimpleDateFormat;
Date currentTimeStamp = new java.util.Date()
String tz = "GMT" // or any other time zone
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy")
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm")
dateFormat.setTimeZone(TimeZone.getTimeZone(tz))
timeFormat.setTimeZone(TimeZone.getTimeZone(tz))
String date = dateFormat.format(currentTimeStamp)
String time = timeFormat.format(currentTimeStamp)