Segments: Time and Date Script

219,167pages on
this wiki
Add New Page
Discuss this page0 Share


Below is a simple script to get several formats of the time or date in DesktopX. Create a simple text object and insert the script.

Sub Object_OnScriptEnter
object.Settimer 1, 1000'-Set a 1 second timer
End Sub

'-Check the time every second
Sub Object_Ontimer1
	dateNtime= Now()'-Current date and time
	date1= FormatDateTime(now,1)'--Full date
	date2= FormatDateTime(now,2)'--Short date
	date3= Day(date)'--Current day of the month
	day1= WeekdayName(Weekday(Date), False)'--Full weekday
	day2= WeekdayName(Weekday(Date),True)'--Abbreviated weekday
	day3= Weekday(now)'--Number representing day of week
	currentmonth1= MonthName(Month(now),False)'--Full month
	currentmonth2= MonthName(Month(now),True)'--Abbreviated month
	currentmonth3= Month(now)'--Number representing month of year
	currentyear= Year(now)'--Current year
	thetime= Time'--Current time
	thetime2= FormatDateTime(now,3)'--Current time in 24-hour format
	thehour= hour(now)'--Current hour in 24-hour format
	theminute= Minute(now)'--Current minute
	thesecond= Second(now)'--Current second
	object.text = dateNtime
End Sub

Replace object.text = dateNtime with object.text = thesecond and you'll get the current second. Try out all the different variables and see the results.


None right now.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random wikia