Follow by Email

Friday, January 3, 2014

Converting Date And Time

**conversion of date in ("mm/dd/yy, day of week" format & CST time zone)

q:((month of date (time zone "cst") of it) as two digits & "/" & day_of_month of date (time zone "cst") of it as two digits & "/" & year of date (time zone "cst") of it as string & "," & first 3 of (date(time zone("cst")) of it as string)) of now
A: 12/27/2013,Fri
T: 0.088 ms

**conversion of time in("hrs:mins am/pm" format & CST time zone)

q:((if(hour_of_day of it<12) then (hour_of_day of it as string & ":" & minute_of_hour of it as string & "am") else(((hour_of_day of it as integer)-12) as string)& ":" & minute_of_hour of it as string & "pm") of time(time zone "cst") of it) of now
A: 10:42am
T: 0.076 ms

**conversion of date & time in ("mm/dd/yy,day of week hrs:mins am/pm" format & CST time zone)

q:((month of date (time zone "cst") of it) as two digits & "/" & day_of_month of date (time zone "cst") of it as two digits & "/" & year of date (time zone "cst") of it as string & "," & first 3 of (date(time zone("cst")) of it as string)& " " & (if(hour_of_day of it<12) then (hour_of_day of it as string & ":" & minute_of_hour of it as string & "am") else(((hour_of_day of it as integer)-12) as string)& ":" & minute_of_hour of it as string & "pm") of time(time zone "cst") of it) of now
A: 12/27/2013,Fri 10:42am

T: 0.133 ms

No comments:

Post a Comment