الفرق بين المراجعتين ل"Ruby/Time/dst-3F"

من موسوعة حسوب
< Ruby‏ | Time
اذهب إلى التنقل اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: التابع <code>day‎</code> الخاص بالصنف <code>Time</code> في روبي}}</noinclude> تصنيف: Ruby تصنيف: R...')
 
سطر 1: سطر 1:
<noinclude>{{DISPLAYTITLE: التابع <code>day‎</code> الخاص بالصنف <code>Time</code> في روبي}}</noinclude>
+
<noinclude>{{DISPLAYTITLE: التابع <code>dst?‎‎</code> الخاص بالصنف <code>Time</code> في روبي}}</noinclude>
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby Method]]
 
[[تصنيف: Ruby Method]]
 
[[تصنيف: Ruby Time]]
 
[[تصنيف: Ruby Time]]
يستخلص التابع <code>day</code> من [[Ruby/Time|التوقيت]] رقم اليوم من الشهر (1..n) لـ <code>time</code>.
+
يُعيد التابع <code>dst?‎</code> القيمة <code>true</code> إن وقع <code>time</code> أثناء التوقيت الصيفي <code>[[Ruby/Time|Time]]</code> في المنطقة الزمنية الخاصة به.
 
==البنية العامة==
 
==البنية العامة==
<syntaxhighlight lang="ruby">day integer‎</syntaxhighlight>
+
<syntaxhighlight lang="ruby">dst? true or false‎</syntaxhighlight>
 
==القيمة المُعادة==
 
==القيمة المُعادة==
 
==أمثلة==
 
==أمثلة==
مثال على استخدام التابع <code>day‎</code>:
+
مثال على استخدام التابع <code>dst?‎</code>:
<syntaxhighlight lang="ruby">t = Time.now   #=> 2007-11-19 08:27:03 -0600
+
<syntaxhighlight lang="ruby"># CST6CDT:
t.day          #=> 19
+
  Time.local(2000, 1, 1).zone    #=> "CST"
t.mday        #=> 19‎</syntaxhighlight>
+
  Time.local(2000, 1, 1).isdst  #=> false
 +
   Time.local(2000, 1, 1).dst?    #=> false
 +
  Time.local(2000, 7, 1).zone    #=> "CDT"
 +
  Time.local(2000, 7, 1).isdst  #=> true
 +
  Time.local(2000, 7, 1).dst?    #=> true
 +
# Asia/Tokyo:
 +
  Time.local(2000, 1, 1).zone    #=> "JST"
 +
  Time.local(2000, 1, 1).isdst  #=> false
 +
  Time.local(2000, 1, 1).dst?    #=> false
 +
  Time.local(2000, 7, 1).zone    #=> "JST"
 +
  Time.local(2000, 7, 1).isdst  #=> false
 +
  Time.local(2000, 7, 1).dst?    #=> false‎</syntaxhighlight>
 
==انظر أيضا==
 
==انظر أيضا==
* التابع <code>[[Ruby/Time/ctime|ctime]]</code>: يُعيد التابع <code>ctime</code> تمثيلا نصيا قانونيا لل[[Ruby/Time|توقيت]] <code>time</code>.
+
* التابع <code>[[Ruby/Time/day|day]]</code>: يستخلص التابع <code>day</code> من [[Ruby/Time|التوقيت]] رقم اليوم من الشهر (1..n) لـ <code>time</code>.
* التابع <code>[[Ruby/Time/dst-3F|dst?‎]]</code>: يُعيد التابع <code>dst?‎</code> القيمة <code>true</code> إن وقع <code>time</code> أثناء التوقيت الصيفي <code>[[Ruby/Time|Time]]</code> في المنطقة الزمنية الخاصة به.
+
* التابع <code>[[Ruby/Time/eql-3F|eql?‎]]</code>: يُعيد <code>true</code> إذا كان كل من <code>time</code> و <code>other_time</code> (انظر فقرة البنية العامة) [[Ruby/Time|توقيت]] <code>[[Ruby/Time|Time]]</code>، وكان لهما نفس عدد الثواني وكسور الثواني.
 
==مصادر==
 
==مصادر==
*[http://ruby-doc.org/core-2.5.1/Time.html#method-i-day قسم  التابع day‎ في الصنف Time‎ في توثيق روبي الرسمي.]
+
*[http://ruby-doc.org/core-2.5.1/Time.html#method-i-dst-3F قسم  التابع dst?‎ في الصنف Time‎ في توثيق روبي الرسمي.]

مراجعة 13:17، 7 نوفمبر 2018

يُعيد التابع dst?‎ القيمة true إن وقع time أثناء التوقيت الصيفي Time في المنطقة الزمنية الخاصة به.

البنية العامة

dst?   true or false

القيمة المُعادة

أمثلة

مثال على استخدام التابع dst?‎:

# CST6CDT:
  Time.local(2000, 1, 1).zone    #=> "CST"
  Time.local(2000, 1, 1).isdst   #=> false
  Time.local(2000, 1, 1).dst?    #=> false
  Time.local(2000, 7, 1).zone    #=> "CDT"
  Time.local(2000, 7, 1).isdst   #=> true
  Time.local(2000, 7, 1).dst?    #=> true
# Asia/Tokyo:
  Time.local(2000, 1, 1).zone    #=> "JST"
  Time.local(2000, 1, 1).isdst   #=> false
  Time.local(2000, 1, 1).dst?    #=> false
  Time.local(2000, 7, 1).zone    #=> "JST"
  Time.local(2000, 7, 1).isdst   #=> false
  Time.local(2000, 7, 1).dst?    #=> false‎

انظر أيضا

  • التابع day: يستخلص التابع day من التوقيت رقم اليوم من الشهر (1..n) لـ time.
  • التابع eql?‎: يُعيد true إذا كان كل من time و other_time (انظر فقرة البنية العامة) توقيت Time، وكان لهما نفس عدد الثواني وكسور الثواني.

مصادر