<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Script Solution&#187; date</title>
	<atom:link href="http://www.openscriptsolution.com/tag/date/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.openscriptsolution.com</link>
	<description>... where solutions for script programming are found ...</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:22:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Know The Number of Days from Monday until Today of This Week in PHP</title>
		<link>http://www.openscriptsolution.com/2009/12/13/how-to-know-the-number-of-days-from-monday-until-today-of-this-week-in-php/</link>
		<comments>http://www.openscriptsolution.com/2009/12/13/how-to-know-the-number-of-days-from-monday-until-today-of-this-week-in-php/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 16:26:49 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[day]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Monday]]></category>
		<category><![CDATA[number of days]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[today]]></category>
		<category><![CDATA[week]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1025</guid>
		<description><![CDATA[There was a question asked to myself how to know the number of days that calculated from Monday until today of this week by using PHP script. Well, actually, we can make a function by checking based on the day name of today, then return the value based on its day name to the function. [...]]]></description>
			<content:encoded><![CDATA[<p>There was a question asked to myself how to know the number of days that calculated from Monday until today of this week by using PHP script. Well, actually, we can make a function by checking based on the day name of today, then return the value based on its day name to the function. So here is the solution I made. <span id="more-1025"></span></p>
<p>Create a php file named <strong>daysnumber.php</strong>, and copy-paste this following code into it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * @author Masino Sinaga, http://www.openscriptsolution.com
 * @copyright December 13, 2009
 */</span>
&nbsp;
<span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> DaysNumberStartedFromMondayUntilTodayThisWeek<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'The number of days from Monday until today is &lt;b&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$days</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/b&gt; day(s).'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> DaysNumberStartedFromMondayUntilTodayThisWeek<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
  <span style="color: #000088;">$dayname</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$dayname</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Sun'</span><span style="color: #339933;">:</span>
	  <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span> 
	  <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Mon'</span><span style="color: #339933;">:</span>
          <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	  <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Tue'</span><span style="color: #339933;">:</span>
	  <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	  <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Wed'</span><span style="color: #339933;">:</span>
	  <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
	  <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Thu'</span><span style="color: #339933;">:</span>
	  <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
  	  <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Fri'</span><span style="color: #339933;">:</span>
          <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
	  <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Sat'</span><span style="color: #339933;">:</span>
          <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
          <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$days</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F13%2Fhow-to-know-the-number-of-days-from-monday-until-today-of-this-week-in-php%2F&amp;title=How%20to%20Know%20The%20Number%20of%20Days%20from%20Monday%20until%20Today%20of%20This%20Week%20in%20PHP" id="wpa2a_2"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/12/13/how-to-know-the-number-of-days-from-monday-until-today-of-this-week-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Hide Date Based on Specified Page&#8217;s Title in iNove Theme of WordPress</title>
		<link>http://www.openscriptsolution.com/2009/12/06/how-to-hide-date-based-on-specified-page-s-title-in-inove-theme-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2009/12/06/how-to-hide-date-based-on-specified-page-s-title-in-inove-theme-of-wordpress/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 06:55:40 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[iNove]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=967</guid>
		<description><![CDATA[Have you ever wanted to hide the created date that displayed in a specified page based on its title page on your WordPress blog? For example, you used a page with permalink forum and its title page is Forum whereas the content of its page derived from the certain plugin that adding the Discussion Forum [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to hide the created date that displayed in a specified page based on its title page on your WordPress blog? For example, you used a page with permalink <strong>forum</strong> and its title page is <strong>Forum</strong> whereas the content of its page derived from the certain plugin that adding the Discussion Forum on your WordPress blog. Well, here is the solution how you can hide that date on the page. <span id="more-967"></span></p>
<p>Open your <strong>\wp-content\themes\inove\page.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">			&lt;span class=&quot;date&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_modified_time<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'inove'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;</pre></td></tr></table></div>

<p>then replace with this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Forum'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			&lt;span class=&quot;date&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_modified_time<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'inove'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>If you want to add more than one page, then adjust this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Forum'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>become:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Forum'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Your Another Page Title'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Hope it helps you.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F06%2Fhow-to-hide-date-based-on-specified-page-s-title-in-inove-theme-of-wordpress%2F&amp;title=How%20to%20Hide%20Date%20Based%20on%20Specified%20Page%26%238217%3Bs%20Title%20in%20iNove%20Theme%20of%20WordPress" id="wpa2a_4"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/12/06/how-to-hide-date-based-on-specified-page-s-title-in-inove-theme-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Calculate Difference Between Two Dates Using VB6</title>
		<link>http://www.openscriptsolution.com/2009/09/01/how-to-calculate-difference-between-two-dates-using-vb6/</link>
		<comments>http://www.openscriptsolution.com/2009/09/01/how-to-calculate-difference-between-two-dates-using-vb6/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 13:38:35 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[Date and Time]]></category>
		<category><![CDATA[between]]></category>
		<category><![CDATA[calculate]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[dates]]></category>
		<category><![CDATA[difference]]></category>
		<category><![CDATA[hitung]]></category>
		<category><![CDATA[selisih]]></category>
		<category><![CDATA[tanggal]]></category>
		<category><![CDATA[two]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=175</guid>
		<description><![CDATA[This following code will show you how to calculate difference between two dates by using Visual Basic 6. The calculation result will give you an output that contains of the difference between those two dates in format: Days, Hours:Minutes:Seconds. The both dates must be in complete format. For example: the first date is March 1, [...]]]></description>
			<content:encoded><![CDATA[<p>This following code will show you how to calculate difference between two dates by using Visual Basic 6. The calculation result will give you an output that contains of the difference between those two dates in format: <strong>Days, Hours:Minutes:Seconds</strong>. The both dates must be in complete format. For example: the first date is March 1, 2002 17:18:00, and the second date is September 1, 2002 09:42:30. After being calculated, then the output will give you the result as follow: 183 day(s), 16:24:30. It means: The difference between those two dates is: 183 days, 16 hours, 24 minutes, and 30 seconds.<span id="more-175"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'Description: Calculate difference between 2 particular dates 
</span><span style="color: #008000;">'             and show the result in format: day(s), hr:min:sec
</span><span style="color: #008000;">'             For example: 
</span><span style="color: #008000;">'             The first date  = 01/03/2002 17:18:00 and 
</span><span style="color: #008000;">'             The second date = 01/09/2002 09:42:30, then
</span><span style="color: #008000;">'             the result will output --&gt; 183 day(s), 16:24:30 
</span><span style="color: #008000;">'             (183 days, 16 hours, 24 minutes, and 30 seconds).
</span><span style="color: #008000;">'             You can use the DateDiff function belongs to VB6
</span><span style="color: #008000;">'Author     : Masino Sinaga 
</span><span style="color: #008000;">'Created    : Sunday, September 1, 2002
</span><span style="color: #008000;">'Preparation: 1. Create a new standar exe project with 1 Form.
</span><span style="color: #008000;">'             2. Add controls: 2 TextBoxes, 1 Label, and 1 Timer.
</span><span style="color: #008000;">'             3. Copy this following code to the form editor form.
</span><span style="color: #008000;">'-------------------------------------------------------------------
</span>
<span style="color: #E56717; font-weight: bold;">Option</span> <span style="color: #E56717; font-weight: bold;">Explicit</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Function</span> CalcDiff2Dates(<span style="color: #151B8D; font-weight: bold;">ByVal</span> d1 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Date</span>, _
                        <span style="color: #151B8D; font-weight: bold;">ByVal</span> d2 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Date</span>) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
  <span style="color: #151B8D; font-weight: bold;">Dim</span> Second <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>, Day <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>, Hour <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>
  <span style="color: #151B8D; font-weight: bold;">Dim</span> CompleteHour <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
&nbsp;
  <span style="color: #8D38C9; font-weight: bold;">If</span> d1 &gt; d2 <span style="color: #8D38C9; font-weight: bold;">Then</span>
     MsgBox <span style="color: #800000;">&quot;The first date must be lower than &quot;</span> &amp; _
            <span style="color: #800000;">&quot;the second date!&quot;</span>, _
            vbCritical, <span style="color: #800000;">&quot;Warning&quot;</span>
     <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Function</span>
  <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
  <span style="color: #008000;">'Count the difference in seconds
</span>  Second = DateDiff(<span style="color: #800000;">&quot;s&quot;</span>, d1, d2)
&nbsp;
  <span style="color: #008000;">'Calculate the hour by dividing with 3600
</span>  <span style="color: #008000;">'(backslash (&quot;\&quot;) in order to get the Integer
</span>  <span style="color: #008000;">'without decimal value)
</span>  Hour = Second \ 3600
&nbsp;
  <span style="color: #008000;">'If hour greater than 23
</span>  <span style="color: #008000;">'it means: more than 1 day
</span>  <span style="color: #8D38C9; font-weight: bold;">If</span> Hour &gt; 23 <span style="color: #8D38C9; font-weight: bold;">Then</span>
&nbsp;
     <span style="color: #008000;">'Calculate day by dividing with 24
</span>     <span style="color: #008000;">'(backslash (&quot;\&quot;) in order to get the Integer
</span>     <span style="color: #008000;">'value without decimal value)
</span>     Day = Hour \ 24
&nbsp;
     <span style="color: #008000;">'Calculate the hour duration in hh:mm:ss
</span>     CompleteHour = Format((d2 - d1), <span style="color: #800000;">&quot;hh:mm:ss&quot;</span>)
&nbsp;
  <span style="color: #8D38C9; font-weight: bold;">Else</span> <span style="color: #008000;">'If the hour less than or equal with 23      
</span>
     Day = 0   <span style="color: #008000;">'assign the Day with zero value      
</span>
     <span style="color: #008000;">'Calculate hour duration in hh:mm:ss
</span>     CompleteHour = Format((d2 - d1), <span style="color: #800000;">&quot;hh:mm:ss&quot;</span>)
&nbsp;
  <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>  
&nbsp;
  <span style="color: #8D38C9; font-weight: bold;">If</span> Day = 0 <span style="color: #8D38C9; font-weight: bold;">Then</span>  <span style="color: #008000;">'If less than 1 day
</span>
     <span style="color: #008000;">'Get the final result
</span>     CalcDiff2Dates = CompleteHour
&nbsp;
  <span style="color: #8D38C9; font-weight: bold;">Else</span>  <span style="color: #008000;">'If day greater than 0, show the day duration     
</span>
     <span style="color: #008000;">'Get the final result
</span>     CalcDiff2Dates = Day &amp; <span style="color: #800000;">&quot; day(s), &quot;</span> &amp; CompleteHour
&nbsp;
  <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
  <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Form_Load()
  Timer1.Interval = 500
  Timer1.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
  Text1.Text = <span style="color: #800000;">&quot;01/03/2002 17:18:00&quot;</span>
  <span style="color: #008000;">'Text2.Text = &quot;01/09/2002 09:42:30&quot;
</span>  Text2.Text = Now
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Timer1_Timer()
  <span style="color: #151B8D; font-weight: bold;">On</span> <span style="color: #151B8D; font-weight: bold;">Error</span> <span style="color: #8D38C9; font-weight: bold;">GoTo</span> ErrHandler
  Text2.Text = Now
  Label1.Caption = CalcDiff2Dates(CDate(Text1.Text), _
                      CDate(Text2.Text))
  <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
ErrHandler:
  MsgBox <span style="color: #800000;">&quot;Invalid date or format!&quot;</span>, _
         vbCritical, <span style="color: #800000;">&quot;Error Date&quot;</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span></pre></td></tr></table></div>

<p>From the code above, the first parameter belongs to the <strong>CalcDiff2Dates</strong> function placed on Text1 control, whereas the second parameter placed on Text2 which its value being generated by Timer1 control using time interval one second. </p>
<p>The result being shown at Label1 control based the changes generated by Timer1 control. Of course, you may modify that code above by yourself. For example, by removing the Timer control and disable the Timer code, and then simply use the <strong>CalcDiff2Dates</strong> function only in Form_Load procedure.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F09%2F01%2Fhow-to-calculate-difference-between-two-dates-using-vb6%2F&amp;title=How%20to%20Calculate%20Difference%20Between%20Two%20Dates%20Using%20VB6" id="wpa2a_6"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/09/01/how-to-calculate-difference-between-two-dates-using-vb6/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to Convert 10 Digits Numeral to The Date Value?</title>
		<link>http://www.openscriptsolution.com/2009/08/29/how-to-convert-10-digits-numeral-to-the-date-value/</link>
		<comments>http://www.openscriptsolution.com/2009/08/29/how-to-convert-10-digits-numeral-to-the-date-value/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 11:17:29 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[Date and Time]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[digits]]></category>
		<category><![CDATA[numeral]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=137</guid>
		<description><![CDATA[I have hundreds of records that need to be imported from one table and database (let&#8217;s say that this is the first database) to another table in different database (and the last one is the second database). Unfortunately, one of the columns in the table in first database has the Date value in 10 digits [...]]]></description>
			<content:encoded><![CDATA[<p>I have hundreds of records that need to be imported from one table and database (let&#8217;s say that this is the first database) to another table in different database (and the last one is the second database). Unfortunately, one of the columns in the table in first database has the Date value in 10 digits numeral format. For example: <strong>1206980969</strong>. Actually, this value equals with <strong>March 31, 2008 16:29:29 on UTC</strong>. Then, how do I convert that 10 digits numeral to the Data value since the column in the second database is a Date field type? And how do I convert again that date according to my local time?  <span id="more-137"></span></p>
<p>Okay. Here is the solution that I made from Visual Basic 6. First of all, you should create a new function for this.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #E56717; font-weight: bold;">Option</span> <span style="color: #E56717; font-weight: bold;">Explicit</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #151B8D; font-weight: bold;">Declare</span> <span style="color: #E56717; font-weight: bold;">Function</span> GetTimeZoneInformation Lib <span style="color: #800000;">&quot;KERNEL32.dll&quot;</span> (lpTimeZoneInformation <span style="color: #151B8D; font-weight: bold;">As</span> TIME_ZONE_INFORMATION) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #151B8D; font-weight: bold;">Type</span> SYSTEMTIME
   wYear                <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
   wMonth               <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
   wDayOfWeek           <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
   wDay                 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
   wHour                <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
   wMinute              <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
   wSecond              <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
   wMilliseconds        <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #151B8D; font-weight: bold;">Type</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #151B8D; font-weight: bold;">Type</span> TIME_ZONE_INFORMATION
   Bias                 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>
   StandardName         <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> * 64
   StandardDate         <span style="color: #151B8D; font-weight: bold;">As</span> SYSTEMTIME
   StandardBias         <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>
   DaylightName         <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> * 64
   DaylightDate         <span style="color: #151B8D; font-weight: bold;">As</span> SYSTEMTIME
   DaylightBias         <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #151B8D; font-weight: bold;">Type</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Private</span> Const TIME_ZONE_ID_DAYLIGHT <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span> = 2
<span style="color: #E56717; font-weight: bold;">Private</span> Const Unix1970   <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span> = 25569 <span style="color: #008000;">'CDbl(DateSerial(1970, 1, 1))
</span>
<span style="color: #E56717; font-weight: bold;">Public</span> <span style="color: #E56717; font-weight: bold;">Function</span> Unix2Date(vUnixDate <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> bReturnUTC <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Boolean</span>) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Date</span>
   Unix2Date = DateAdd(<span style="color: #800000;">&quot;s&quot;</span>, vUnixDate, Unix1970) - IIf(bReturnUTC, 0, GetCurrentTZOffset)
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Public</span> <span style="color: #E56717; font-weight: bold;">Function</span> GetCurrentTZOffset() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Double</span>
   <span style="color: #151B8D; font-weight: bold;">Dim</span> tz               <span style="color: #151B8D; font-weight: bold;">As</span> TIME_ZONE_INFORMATION
   <span style="color: #151B8D; font-weight: bold;">Dim</span> lRet             <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>
   <span style="color: #008000;">'Quickest way to see if we are in
</span>   <span style="color: #008000;">'Daylight savings is to check lRet
</span>   lRet = GetTimeZoneInformation(tz)
   <span style="color: #008000;">'Offset in minutes
</span>   GetCurrentTZOffset = tz.Bias + IIf(lRet = TIME_ZONE_ID_DAYLIGHT, tz.DaylightBias, tz.StandardBias)
   GetCurrentTZOffset = GetCurrentTZOffset / 1440
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Command1_Click()
   MsgBox <span style="color: #800000;">&quot;UTC   = &quot;</span> &amp; Unix2Date(1206980969, <span style="color: #00C2FF; font-weight: bold;">True</span>) <span style="color: #008000;">'March 31, 2008 16:29:29 (UTC)
</span>   MsgBox <span style="color: #800000;">&quot;Local = &quot;</span> &amp; Unix2Date(1206980969, <span style="color: #00C2FF; font-weight: bold;">False</span>) <span style="color: #008000;">'March 31, 2008 23:29:29 (UTC + 7)
</span><span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span></pre></td></tr></table></div>

<p>From the code above, the conclusion is: We can use the Unix2Date function which has two parameters in it. The first parameter is the 10 digits numeral value, and the second parameter is the flag whether you want to convert it to UTC or to your local time. If we want to convert it to UTC, then the second parameter value is <strong>True</strong>, whereas if we want to convert it to the local time (in this case I have UTC + 7), the second parameter value is <strong>False</strong>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F08%2F29%2Fhow-to-convert-10-digits-numeral-to-the-date-value%2F&amp;title=How%20to%20Convert%2010%20Digits%20Numeral%20to%20The%20Date%20Value%3F" id="wpa2a_8"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/08/29/how-to-convert-10-digits-numeral-to-the-date-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Convert 5 Digits Numeral to The Date Value?</title>
		<link>http://www.openscriptsolution.com/2009/08/28/how-to-convert-5-digits-numeral-to-the-date-value/</link>
		<comments>http://www.openscriptsolution.com/2009/08/28/how-to-convert-5-digits-numeral-to-the-date-value/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 02:48:01 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[Date and Time]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[digits]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[Macro]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=125</guid>
		<description><![CDATA[A few days ago, a friend of mine asked me for help. He wanted to export his data from Excel file into Access database file. There were about sixteen thousand rows in Excel that have to be exported into Access. One of the columns in that Excel had a Date data. Unfortunately, most of those [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, a friend of mine asked me for help. He wanted to export his data from Excel file into Access database file. There were about sixteen thousand rows in Excel that have to be exported into Access. One of the columns in that Excel had a Date data. Unfortunately, most of those rows have the 5 digits numeral data, and not in the real Date Value data. For example, there was a row with value <strong>&#8217;38353</strong>. As we know, this is not a valid Date, right? Besides that, there is a &#8216; character before the value itself. In this case, that value become a String and not a numeral value anymore. <span id="more-125"></span></p>
<p>If the data does not contain of the &#8216; character at beginning, it is so easy to convert them become Date value, by using Format Cells feature in Excel. Obviously, it took too long time if I have to remove first the &#8216; character for those thousand records, and then do formatting the cell column. Since the date have the &#8216; character, then it will take a long time to remove that character one by one. Even if you want to make the special function to remove this.</p>
<p>So, before I export all about those sixteen thousand rows, I analyzed, which one the best way to do this. Well, finally, I think it is better to convert first those 5 digits numeral data directly to the real Date Value data without having to remove the &#8216; character. I also have to convert this data become the Date format and order: <strong>year-month-date</strong>, such as &#8220;yyyy-MM-dd&#8221;. This &#8220;38353&#8243; value should be like <strong>2005-01-01</strong>. </p>
<p>Actually, the solution that I made for this, is only by using <strong>CDate()</strong> function belongs to VBA (Visual Basic Application) that exists in Excel file. Unfortunately, you cannot use formula <strong>=CDATE()</strong> function directly in the Excel WorkSheet Cell. So, I created this function below from Visual Basic Editor in the Excel file and run it from Macro Excel:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #E56717; font-weight: bold;">Public</span> <span style="color: #E56717; font-weight: bold;">Function</span> ConvertDateStringToDateValue()
  <span style="color: #8D38C9; font-weight: bold;">With</span> Sheet1
    <span style="color: #8D38C9; font-weight: bold;">For</span> i = 2 <span style="color: #8D38C9; font-weight: bold;">To</span> 16000 <span style="color: #008000;">'first row is the header column, so we start from the 2nd row
</span>      <span style="color: #8D38C9; font-weight: bold;">If</span> IsDate(.Cells(i, 7)) <span style="color: #8D38C9; font-weight: bold;">Then</span> <span style="color: #008000;">'check whether the Date value in the 7th column
</span>        <span style="color: #008000;">'among those 16,000 rows, not all rows contain of the DateString
</span>        <span style="color: #008000;">'so, if the Cell value is a real Date, do nothing here...
</span>      <span style="color: #8D38C9; font-weight: bold;">Else</span> <span style="color: #008000;">'Else, if the cell value not a Date type
</span>        <span style="color: #008000;">'let's convert the Cell here, and put the result in to the 11th column
</span>        .Cells(i, 11).Value = Format(CDate(.Cells(i, 7).Value), <span style="color: #800000;">&quot;yyyy-MM-dd&quot;</span>)
      <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
    <span style="color: #8D38C9; font-weight: bold;">Next</span> i
  <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">With</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span></pre></td></tr></table></div>

<p>From the code above, we can see that the 5 digits numeral value located on the seventh column or column <strong>G</strong>, meanwhile the real Date Value I put on the eleventh column or column <strong>K</strong> in Excel file.</p>
<p>The conclusion? Well, the solution I made is by using <strong>CDate()</strong> and <strong>Format()</strong> function in Visual Basic Application (VBA) from Visual Basic editor belongs to the Excel file. We cannot use the Excel formula directly on the Sheet.  It took only moreless about a few seconds to convert the 5 digits numeral to the Date Value. Meanwhile, the export process itself from the Excel file into the Access database file took only a few seconds, too.  I just used the <strong>Get External Data</strong> from the Access database file from menu: &#8220;File -&gt; Get External Data -&gt; Import&#8230;&#8221;.</p>
<p>Thanks to the <strong>CDate()</strong> and <strong>Format()</strong> functions that available in VBA Excel, and also to the <strong>Get External Data</strong> feature that available in Microsoft Access.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F08%2F28%2Fhow-to-convert-5-digits-numeral-to-the-date-value%2F&amp;title=How%20to%20Convert%205%20Digits%20Numeral%20to%20The%20Date%20Value%3F" id="wpa2a_10"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/08/28/how-to-convert-5-digits-numeral-to-the-date-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change the Date Format in WordPress Theme</title>
		<link>http://www.openscriptsolution.com/2009/08/23/change-the-date-format-in-wordpress-theme/</link>
		<comments>http://www.openscriptsolution.com/2009/08/23/change-the-date-format-in-wordpress-theme/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 13:34:21 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[tanggal]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[ubah]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=48</guid>
		<description><![CDATA[If you want to change the date format based on your theme that you are using in WordPress, then you have to edit a code or such a string in the .po and .mo file, regarding to your language in that theme. Typically, these files are located in \themes\{yourtheme}\{langdirectory}\ sub directory. Adjust {yourtheme} with your [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to change the date format based on your theme that you are using in WordPress, then you have to edit a code or such a string in the .po and .mo file, regarding to your language in that theme. Typically, these files are located in <strong>\themes\{yourtheme}\{langdirectory}\</strong> sub directory. Adjust {yourtheme} with your theme name, and {langdirectory} with your language directory name (some themes using &#8220;lang&#8221;; and the others using &#8220;language&#8221; as the language directory name). <span id="more-48"></span></p>
<p>Let&#8217;s see this example. I want to change the date format based on my language; Indonesian, then all I have to do is:</p>
<ol>
<li> Download your id_ID.po and id_ID.mo file from that sub directory above (adjust with your own language).</li>
<li> Open id_ID.po file with tools named <a href="http://www.openscriptsolution.com/2009/08/22/poedit-translation-tools-for-wordpress/" target="_blank"><strong>Poedit</strong></a>.</li>
<li> Search for the string &#8220;<strong>F jS, Y</strong>&#8220;. If you open this .po file with text editor application, such as Notepad or TextPad, this located in <strong>msgid</strong> section.</li>
<li> Change the value in <strong>msgstr</strong> section, to your date format. For example, I want to display the date with order: <strong>date month year</strong>, such as: <strong>22 Januari 1973</strong>, then I change the value become: &#8220;<strong>j F Y</strong>&#8220;. Please make sure once again, you change the string in <strong>msgstr</strong> section.</li>
<li>Save the id_ID.po file with Poedit whereas this will also update the <strong>id_ID.mo</strong> file.</li>
<li> Upload both files to your web server to the sub directory above.</li>
</ol>
<p>That&#8217;s all. Now the date format should has been changed, according to the new format based on your own selected language.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F08%2F23%2Fchange-the-date-format-in-wordpress-theme%2F&amp;title=Change%20the%20Date%20Format%20in%20WordPress%20Theme" id="wpa2a_12"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/08/23/change-the-date-format-in-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>
