How to determine the date of the day?

xiaoxiao2021-03-06  77

Main topic: How to determine this date is a day, please help. Servers: R9lu (fish in late swimming) Credit value: 100 Forum: Java JSP / servlet / javabean problem points: 20 replies: 13 Posted: 2004-8-24 16:30:06 There are two small problems

1. What is the value of the date type (04-8-24 0: 0: 0: 0) from a result set, how to save him to a variable

2. How do you get the date of the day if you save your dates into a character.

The ultimate goal hopes to get this date is the day of the week. Even the novice, please help solve it.

Reply to: Nanman (Nanban-500,000 author used by the strongest five author) () Reputation: 120 2004-8-24 16:35:37 Score: 5 TimeStamp Date = rs.getTimeStamp (n);

Calendar Cal = Calendar.getInstance ();

Cal.SetTime (date);

INT week = caver.get (calendar.day_of_week); // Week

TOP

Reply to: r9lu (fish in the evening) () Reputation: 100 2004-8-24 17:00:57 Score: 0 When compiled:

Cannot Resolve Symbol

Class TimeStamp

Method getTimeStamp

TOP

Reply to: Power17 () () Reputation: 105 2004-8-24 17:18:11 Score: 5

The worst method in the world:

<% @ Page ContentType = "Text / HTML; Charset = GB2312" Language = "Java" Import = "java.sql. *" ErrorPage = ""%>

<% @ Page Import = "java.util. *"%>

No title document </ Title></p> <p></ hEAD></p> <p><body></p> <p><%</p> <p>Java.util.date Date = new java.util.date (104, 8, 24, 0, 0);</p> <p>Out.println (Date.getDay ());</p> <p>%></p> <p></ body></p> <p></ html></p> <p>TOP</p> <p>Reply to: AOPLO (Brother) () Reputation: 97 2004-8-24 17:19:55 Score: 2 See your RS.GetTimeStamp (n); the field of N) is not a date type, don't The corresponding is wrong.</p> <p>Nanban should have no problem!</p> <p>TOP</p> <p>Reply to: wwwer1 (Wuling Herger) () Reputation: 100 2004-8-24 17:30:12 Score: 0 There is also a simple way to calculate directly in SQL, but not very good</p> <p>For example, in SQL Server: SELECT datepart (weekday, '2004-8-23')</p> <p>The following date can be replaced with the field in your database</p> <p>TOP</p> <p>Reply to: Power17 () () Reputation: 105 2004-8-24 17:33:53 Score: 3 <% @ Page ContentType = "Text / HTML; Charset = GB2312" Language = "Java" Import = "java.sql "" ErrorPage = ""%></p> <p><% @ Page Import = "java.util. *"%></p> <p><! Doctype html public "- // w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/HTML4/LOOSE.DTD"></p> <p><html></p> <p><HEAD></p> <p><meta http-equiv = "content-type" content = "text / html; charSet = GB2312"></p> <p><title> No title document </ Title></p> <p></ hEAD></p> <p><body></p> <p><%</p> <p>Calendar Date = Calendar.getInstance ();</p> <p>Date.set (104, 8, 24, 0, 0);</p> <p>Out.println (Date.Get (Calendar.day_of_week);</p> <p>%></p> <p></ body></p> <p></ html></p> <p>TOP</p> <p>Reply to: DDO831 (This user can't be blocked) () Reputation: 100 2004-8-24 17:50:16 Score: 0, rs.gettimestamp (n); What is the RS in?</p> <p>TOP</p> <p>Reply to: r9lu (fish in the evening) () Reputation: 100 2004-8-24 17:50:59 Score: 0 I can realize this method</p> <p>Int z;</p> <p>String weekstr = ""</p> <p>Date tmpdate = new date ();</p> <p>z = tmpdate.getday ();</p> <p>Switch (z)</p> <p>{</p> <p>Case 0:</p> <p>Weekstr = "Sunday";</p> <p>Break;</p> <p>Case 1:</p> <p>Weekstr = "Monday";</p> <p>Break;</p> <p>Case 2:</p> <p>Weekstr = "Tuesday";</p> <p>Break;</p> <p>Case 3:</p> <p>Weekstr = "Wednesday";</p> <p>Break;</p> <p>Case 4:</p> <p>Weekstr = "Thursday";</p> <p>Break;</p> <p>Case 5:</p> <p>Weekstr = "Friday";</p> <p>Break;</p> <p>Case 6:</p> <p>Weekstr = "Saturday";</p> <p>Break;</p> <p>}</p> <p>But the getday () method is only Date type data, and my date value is obtained from a result set, how to save this dates value into a variable and still DATE.</p> <p>I am using String RundateStr = ParentBean.getstring ("Rundate");</p> <p>Can only save it into a string type</p> <p>Ask you.</p> <p>TOP</p> <p>Reply to: r9lu (fish for a day to night) () Reputation: 100 2004-8-25 10:30:03 Score: 0 Please help us to see Top</p> <p>Reply to: chDW (m) () Reputation: 150 2004-8-25 10:32:30 Score: 2 getTimeStamp (int columnIndex) is the standard method of ResultSet, how can it be</p> <p>You are wrong, or your RS is not a resultset type.</p> <p>TOP</p> <p>Reply to: zhaoqiubo (Zhao Xiaojian) () Reputation: 100 2004-8-25 11:02:51 Score: 1 Translation:</p> <p>Cannot Resolve Symbol</p> <p>Class TimeStamp</p> <p>Method getTimeStamp</p> <p>No import timestamp this thing ...</p> <p>TOP</p> <p>Reply to: swiminthesea (blogd coated) () reputation: 100 2004-8-25 11:17:54 Score: 1 Translation error:</p> <p>Cannot Resolve Symbol</p> <p>Class TimeStamp</p> <p>Method getTimeStamp</p> <p>Yes, IMPORT JAVA.SQL.TIMESTAMP;</p> <p>TOP</p> <p>Reply to: hiking () () Reputation: 100 2004-8-25 12:04:20 Score: 1 There is another question to pay attention:</p> <p>Date in the SQL package is different from the Date in the Util package!</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-106723.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="106723" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.040</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '9JDNaCtFpBAA9RUkM6f3BCNczsOyUNdAVVRo_2FrjR32F_2BZma6TXCaFTOcI03r1fPJmOir1cKWZcQPPzMsQLmwLw_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>