BBC BASIC for Windows
« isolating part of time$ »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:50pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: isolating part of time$  (Read 382 times)
Danny
New Member
Image


member is offline

Avatar




PM


Posts: 12
xx isolating part of time$
« Thread started on: Nov 12th, 2012, 3:32pm »

Hello

I would like to be able to take a part of the time$ information such as the day e.g. "Monday" and to put that into another variable.

Could someone let me know how to do this please.

Danny
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: isolating part of time$
« Reply #1 on: Nov 12th, 2012, 10:00pm »

on Nov 12th, 2012, 3:32pm, Danny wrote:
I would like to be able to take a part of the time$ information such as the day e.g. "Monday" and to put that into another variable.

If you are looking to get only the abbreviated day name (Mon, Tue, Wed etc.) then that's trivial, you just take the first three characters of TIME$ (or four if you want the dot as well):

Code:
      weekday$ = LEFT$(TIME$,3)
      PRINT weekday$ 

But if you want the full name of the day, e.g. "Monday", the easiest way is probably to use the DATELIB library as follows:

Code:
      INSTALL @lib$+"DATELIB"
      
      mjd% = FN_today
      weekday$ = FN_date$(mjd%, "dddd")
      PRINT weekday$ 

Richard.
User IP Logged

Danny
New Member
Image


member is offline

Avatar




PM


Posts: 12
xx Re: isolating part of time$
« Reply #2 on: Nov 13th, 2012, 11:49am »

Thank you Richard. That is exactly what I required.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls