[rp_mysqldatetime]

Description

Link: [rp_mysqldatetime]
Author: Randy Phillips
Category: Date
Version: 8.x
License: Public Domain
Posted: Dec. 08, 2005
Updated: Jan. 18, 2006
More by this author...
This tag can be used in tandem with the rp_datemenu and rp_timemenu cTags. It concatenates date, time and/or datetime values from html select menus for input into MySQL date, time or datetime columns.

Parameters

-dayvalue string, optional This optional parameter takes the day value from the html select menus generated by the DateMenu cTag.
-monthvalue string, optional This optional parameter takes the month value from the html select menus generated by the DateMenu cTag.
-yearvalue string, optional This optional parameter takes the year value from the html select menus generated by the DateMenu cTag.
-hourvalue string, optional This optional parameter takes the hour value from the html select menus generated by the TimeMenu cTag.
-minutevalue string, optional This optional parameter takes the minute value from the html select menus generated by the TimeMenu cTag.
-secondvalue string, optional This optional parameter takes the second value from the html select menus generated by the TimeMenu cTag.
-ampm string, optional This optional parameter takes the AM/PM value from the html radio buttons generated by the TimeMenu cTag.

Sample Usage

[var:'mydatetime' =(rp_mysqldatetime: 
		-dayvalue=(action_param:'day'), 
		-monthvalue=(action_param:'month'), 
		-yearvalue=(action_param:'year'),
		-hourvalue=(action_param:'hrs'),
		-minutevalue=(action_param:'mins'),
		-secondvalue=(action_param:'secs'),
		-ampm=(action_param:'ampm'))]
		
[var:'mydate' =(rp_mysqldatetime: 
		-dayvalue=(action_param:'day'), 
		-monthvalue=(action_param:'month'), 
		-yearvalue=(action_param:'year'))]
		
[var:'mytime' =(rp_mysqldatetime: 
		-hourvalue=(action_param:'hrs'),
		-minutevalue=(action_param:'mins'),
		-secondvalue=(action_param:'secs'),
		-ampm=(action_param:'ampm'))]
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?LassoScript
/*  Author: Randy Phillips
	Company: phillipsIT
	Date: 11/21/2005
	LP8 Version
	This tag can be used in tandem with the DateMenu and TimeMenu cTags.
	It concatenates date, time and/or datetime values for input into MySQL date, time or datetime columns. 
	The optional -dayvalue, -monthvalue and -yearvalue parameters accept values from the 
	html select menus generated by the DateMenu cTag for input into a MySQL date column.
	The optional -hourvalue, -minutevalue, -secondvalue, and -ampm parameters accept values from the
	html select menus generated by the TimeMenu cTag for input into MySQL time or datetime columns.
*/
define_tag:'mysqldatetime', -namespace='RP_',	
		-optional='dayvalue',
		-optional='monthvalue',
		-optional='yearvalue',
		-optional='hourvalue',
		-optional='minutevalue',
		-optional='secondvalue',
		-optional='ampm';
		
		local:'dateconcat' = (string);
		
		// if month text name are used in DateMenu convert to number
		if: (local_defined:'monthvalue');
		select: #monthvalue;		
			case:'January';
			 	local:'mv' = '01';
			case:'February';
			 	local:'mv' = '02';
			case:'March';
			 	local:'mv' = '03';
			case:'April';
			 	local:'mv' = '04';
			case:'May';
			 	local:'mv' = '05';
			case:'June';
			 	local:'mv' = '06';
			case:'July';
			 	local:'mv' = '07';
			case:'August';
			 	local:'mv' = '08';
			case:'September';
			 	local:'mv' = '09';
			case:'October';
			 	local:'mv' = '10';
			case:'November';
			 	local:'mv' = '11';
			case:'December';
			 	local:'mv' = '12';
			case;
				local:'mv' = #monthvalue;
		/select;
		/if;
		// if date is in use format and concatenate date string
		if:(local_defined:'yearvalue') && (local_defined:'dayvalue') && (local_defined:'monthvalue');
 			#dateconcat += #yearvalue + '-' + #mv + '-' + #dayvalue;
 		/if;
 		
 		//if time is in use format and concatenate time string
 		if: (local_defined:'hourvalue') && (local_defined:'minutevalue');
 			
 			if: (local_defined:'ampm') && #ampm == 'pm';
 				select: #hourvalue;
 					case:12;
 						local: 'hv' = 00;
 					case;
 						local: 'hv' = (integer:#hourvalue) + 12;
 				/select;
 			else;
 				local: 'hv' = #hourvalue;
 			/if;
 			
 			if: !(local_defined:'secondvalue');
 				local: 'secondvalue' = 00;
		
		// if month text name are used in DateMenu convert to number
		if: (local_defined:'monthvalue');
		select: #monthvalue;		
			case:'January';
			 	local:'mv' = '01';
			case:'February';
			 	local:'mv' = '02';
			case:'March';
			 	local:'mv' = '03';
			case:'April';
			 	local:'mv' = '04';
			case:'May';
			 	local:'mv' = '05';
			case:'June';
			 	local:'mv' = '06';
			case:'July';
			 	local:'mv' = '07';
			case:'August';
			 	local:'mv' = '08';
			case:'September';
			 	local:'mv' = '09';
			case:'October';
			 	local:'mv' = '10';
			case:'November';
			 	local:'mv' = '11';
			case:'December';
			 	local:'mv' = '12';
			case;
				local:'mv' = #monthvalue;
		/select;
		/if;
		// if date is in use format and concatenate date string
		if:(local_defined:'yearvalue') && (local_defined:'dayvalue') && (local_defined:'monthvalue');
 			#dateconcat += #yearvalue + '-' + #mv + '-' + #dayvalue;
 		/if;
 		
 		//if time is in use format and concatenate time string
 		if: (local_defined:'hourvalue') && (local_defined:'minutevalue');
 			
 			if: (local_defined:'ampm') && #ampm == 'pm';
 				select: #hourvalue;
 					case:12;
 						local: 'hv' = 00;
 					case;
 						local: 'hv' = (integer:#hourvalue) + 12;
 				/select;
 			else;
 				local: 'hv' = #hourvalue;
 			/if;
 			
 			if: !(local_defined:'secondvalue');
 				local: 'secondvalue' = 00;

 			/if;
 			
 			if:(local_defined:'yearvalue') && (local_defined:'dayvalue') && (local_defined:'monthvalue');
 		 		#dateconcat += ' ' + #hv + ':' + #minutevalue + ':' + #secondvalue;
 		 	else;
 		 		#dateconcat += #hv + ':' + #minutevalue + ':' + #secondvalue;
 		 	/if;
 		 	
 		/if;
 			
 		return: #dateconcat;
 
 /define_tag;
 
?>

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net