Friday, April 26, 2013

Date and time string functions




-DateFromDaysSince
Description:
Returns a date by adding an integer to a baseline date
Syntax :
DateFromDaysSince(%number%,[%"yyyy-mm-dd"%])
Example:
no of  days = 8
date = 2009-09-01
DateFromDaysSince(days,date) = 2009-09-09
-DateFromJulianDay
    Description:
Returns a date from the given julian date
Syntax :
DateFromJulianDay(%juliandate%)
Example:
let jdate = 2552812
DateFromJulianDay(jdate) = 2009-09-09
-DaysSinceFromDate
Description:
Returns the number of days from source date to the given date
Syntax:
DaysSinceFromDate(%date%,%”yyyy-mm-dd”%)
Example:
date1 = 2009-09-10
date2 = 2009-09-01
DaysSinceFromDate(date1,date2) = 9
-HoursFromTime
Description:
Returns the hour portion of a time
Syntax :
HoursFromTime(%time%)
Example:
Time= 09:58:15
HoursFromTime(time)= 09
-JulianDayFromDate
        Description:
Returns julian day from the given date
Syntax :
JulianDayFromDate(%date%)
Example:
let date = 2009-09-09
JulianDayFromDate(date) = 2552812
-MicroSecondsFromTime
Description:
Returns the microsecond portion from a time
Syntax :
MicroSecondsFromTime(%time%)
Example:
Time= 09:58:15
MicroSecondsFromTime(time)=0
-MinutesFromTime
Description:
Returns the minute portion from a time
Syntax :
MinutesFromTime(%time%)
Example:
Time= 09:58:15
MinutesFromTime(time)=58
 
-MonthDayFromDate
 Description:
Returns the day of the month given the date
Syntax :
MonthDayFromDate(%date%)
Example:
date = 2009-08-09
MonthDayFromDate(date) = 09
 
-MonthFromDate
Description:
Returns the month number given the date
Syntax :
MonthFromDate(%date%)
Example:
date = 2009-09-10
MonthFromDate(date) = 09
 
-NextWeekdayFromDate
Description:
Returns the date of the specified day of the week soonest after the
Syntax :
NextWeekdayFromDate(%sourcedate%,%dayname%)
Example:
date = 2009-09-04
NextWeekdayFromDate(date,”thu”) = 2009-09-10
-PreviousWeekdayFromDate
Description:
Returns the date of the specified day of the week most recent before the source date
Syntax :
PreviousWeekdayFromDate(%sourcedate%,%dayname%)
Example:
let date = 2009-09-10
PreviousWeekdayFromDate(date,”friday”) = 2009-09-04
 
-SecondsFromTime
Description:
Returns the second portion from a time
Syntax :
SecondsFromTime(%time%)
Example:
time=09:58:15
SecondsFromTime(time)=15
 
-SecondsSinceFromTimestamp
Description:
Returns the number of seconds between two timestamps
Syntax :
SecondsSinceFromTimestamp(%timestamp%,%”yyyy-mm-dd hh:nn:ss”%)
 Example:
-TimeDate
Description:
Returns the system time and date as a formatted string
Syntax :
TimeDate()
Example:
time=09:58:09
date =15 sep 2009
TimeDate()=09:58:09   15 sep 2009
-TimeFromMidnightSeconds
Description:
Returns the time given the number of seconds since midnight
 Syntax :
TimeFromMidnightSeconds(%seconds%)
-TimestampFromDateTime
Description:
Returns a timestamp form the given date and time
Syntax :
TimestampFromDateTime(%date%,%time%)
-TimestampFromSecondsSince
Description:
Returns the timestamp from the number of seconds from the base timestamp
Syntax :
TimestampFromSecondsSince(%seconds%,[%timestamp%])
-TimestampFromTimet
 Description:
Returns a timestamp from the given unix time_t value
Syntax :
TimestampFromTimet(%timetvalue%)
 
-TimetFromTimestamp
Description:
Returns a unix time_t value from the given timestamp
Syntax :
TimetFromTimestamp(%timestamp%)
    
-WeekdayFromDate
 Description:
Returns the day number of the week from the given date. Origin day optionally specifies the day regarded as the first in the week and is Sunday by           default
Syntax :
WeekdayFromDate(%date%,[%startdayname%])
Example:
date = 2001-01-01
WeekdayFromDate(date) = 6
WeekdayFromDate(date,”Mon”) = 0
let date = 2001-01-07
WeekdayFromDate(date) = 0
WeekdayFromDate(date,”Mon”) = 6
-YeardayFromDate
Description:
Returns the day number in the year from the given date
Syntax :
YeardayFromDate(%date%)
Example:
date = 2009-09-01
YeardayFromDate(date) = 1
-YearFromDate
Description:
Returns the year from the given date
Syntax :
YearFromDate(%date%)
Example:
let date = 2009-09-01
YearFromDate(date) = 2009
-YearweekFromDate
Description:
Returns the week number in the year from the given date
Syntax :
YearweekFromDate(%date%)
Example:
let date = 2009-01-06
YearweekFromDate(date) = 1
Date, Time, and Timestamp functions that specify dates, times, or timestamps in the argument use strings with specific formats:
For a date, the format is %yyyy-%mm-%dd
For a time, the format is %hh:%nn:%ss, or, if extended to include microseconds, %hh:%nn:%ss.x where x gives the number of decimal places seconds is given to.
For a timestamp the format is %yyyy-%mm-%dd %hh:%nn:%ss, or, if extended to include microseconds, %yyyy-%mm-%dd %hh:%nn:%ss.x where x gives the number of decimal places seconds is given to.

3 comments:

Unknown said...

very much helpful.. Thanks

Unknown said...

Hi,

if i have this date (2014-01-15) and run the function MonthFromDate(date) the result is 1 and not 01.
Whi??

Thank you so much.

Bye

Rick

joemill00077711 said...

That is the precise weblog for anyone who needs to search out out about this topic. You realize so much its almost laborious to argue with you (not that I actually would need…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just nice! best online casinos