 |
|
BaselScript |
Beschreibung
Date function
Many date functions use a date representation format, for example yyyy-MM-dd or MM/dd/yyyy, etc. Set your date format in the configuration file.
Create date
#date = $date(year,month,day)
Example: #year=2019 #month=2
#date = $date(#year,#month,13)
Result: #date=2019.02.13
If there are no parameters, the current date is returned
Create current date
#current_date = $date()
#result =$date()
Example:
Current date as Friday, 06 February 2020
#config_language = GER (from the file "config")
The result also includes an aggregate of individual fields:
#_current_date = "06.02.2020"
#_current_date_time = "06.02.2020 12:03:00"
#_current_year = 2020
#_current_month = 2
#_current_0month = 02
#_current_month_name = Februar
#_current_day = 6
#_current_0day = 06
#_current_weekday_name = Donnerstag
#_current_weekday = 4
#_current_minute = 10
#_current_secunde = 23
#_current_msecond = 20
Get current date in long format
#current_date = $date.current_long()
#result =$date.current_long()
Example:
Current date as Friday, 06 February 2020
#config_language = GER (from the file "config")
The result also includes an aggregate of individual fields:
#result = "6 February 2020"
#_current_year = 2020
#_current_month = 2
#_current_0month = 02
#_current_month_name = Februar
#_current_day = 6
#_current_0day = 06
#_current_weekday_name = Donnerstag
#_current_weekday = 4
#_current_minute = 10
#_current_secunde = 23
#_current_msecond = 20
Get current date in short format
#current_date = $date.current_short()
Current date as Friday, 06 February 2020
#config_language = GER (from the file "config")
The result also includes an aggregate of individual fields:
#result = "06.02.2020"
#_current_year = 2020
#_current_month = 2
#_current_0month = 02
#_current_month_name = Februar
#_current_day = 6
#_current_0day = 06
#_current_weekday_name = Donnerstag
#_current_weekday = 4
#_current_minute = 10
#_current_secunde = 23
#_current_msecond = 20
Get current time
#current_time = $date.current_time()
Current time as HH:mm:ss
#current_time = "19:15:10"
Get current time AM/PM
#current_time = $date.current_time_pmam()
Current time as hh:mm:ss pmam
#current_time = "09:15:10 PM"
Get day of week
#week_day = $date.day_of_week(#date[,format])
Example 1:
#week_day = $date.day_of_week(20200208,yyyyMMdd)
Result: #week_day = 6
Example 2:
#config_dateformat = yyyy-MM-dd ( s. config)
#dd="2020-02-08"
#week_day = $date.day_of_week(#dd)
Result: #week_day = 6
Get day of year
#year_day = $date.day_of_year(#date[,format])
Example 1:
#year_day = $date.day_of_year(20200208,yyyyMMdd)
Result: #year_day = 37
Example 2:
#year_day = $date.day_of_year(2020-02-08)
#dd="2020-02-08"
#year_day = $date.day_of_year(#dd)
Result: #year_day = 37
Converting the date format
#date = $date.format(string, input format,output format)
#date= $date.format("20180624","yyyyMMdd","dd MMM yyyy")
#date = "24 Jun 2018"
Create date string
#string = $strings_to_dateformat(#day, #month, #year)
Example:
#day="08"
#month="05"
#year="2023"
(default dateformat in config "yyyy.MM.dd")
#string = $strings_to_dateformat(#day, #month, #year)
Result: #string = 2023.05.08
Get of number of 100-nanosecond intervals
#ticks = $date.current_ticks()
Returnes the number of 100-nanosecond intervals
from 12:00:00 midnight, January 1, 0001 Year
Difference between two dates in days
$date.diff_days(yyyy1,MM1,dd1,yyyy2,MM2,dd2)
or
$date.diff_days(#date1,#date2)
Example:
#dif = $date.diff_days(2018,6,24,2018,6,20)
Result: #dif = 4
Example 2:
#d1="2019.02.04"
#d2="2019.02.09"
#dif = $date.diff_days_string(#d1,#d2)
Result: #dif = 5
Difference between two dates
#dif = $date.diff_dates(#datetime1,#datetime2)
Example:
#d1= "8/13/2010 8:33:21"
#d2= "2/9/2012 10:10:11"
#diff = $date.diff_dates(#d1,#d2)
Result:
#_difference_in_years = 1
#_difference_in_months = 5
#_difference_in_days = 27
#_difference_in_hours = 1
#_difference_in_minutes = 36
#_difference_in_seconds = 50
Add years to date
#date = $date.add_years(#datetime,#years)
Example:
#years = 2
#date=$date(2019-01-01 12:00:00)
#date = $date.add_years(#date,#years)
#date= 2021-01-01 12:00:00
Add months to date
#date = $date.add_months(#datetime,#months)
Example:
#months = 2
#date=$date(2019-03-01 12:00:00)
#date = $date.add_years(#date,#months)
#date= 2019-05-01 12:00:00
Add days to date
#date = $date.add_days(#datetime,#days)
Example:
#date=$date(2019-01-01 12:00:00)
#date = $date.add_days(#date,2)
#date= 2019-01-03 12:00:00
Add hours to date
#date = $date.add_hours(#datetime,#hours)
Example:
#date=$date(2019-01-01 12:00:00)
#date = $date.add_hours(#date,7)
#date= 2019-01-01 19:00:00
Add minutes to date
#date = $date.add_hours(#datetime,#minutes)
Example:
#date=$date(2019-01-01 12:00:00)
#date = $date.add_minutes(#date,7)
#date= 2019-01-01 19:07:00
Add seconds to date
#date = $date.add_seconds(#datetime,#seconds)
Example:
#date=$date(2019-01-01 12:00:00)
#date = $date.add_seconds(#date,7)
#date= 2019-01-01 19:00:07
Add years,months,days,hours,minutes,seconds to date
#date = $date.add_seconds(#datetime,years,months,days,hours,minutes,seconds)
Example:
#date=$date.add_years_months_days_hours_minutes_seconds(2019-08-11 12:00:00,1,1,1,1,1,1)
#date= 2019-09-12 13:01:01