Dates before 1970 - date

Could anyone please tell me why Livecode does not convert years before 1970 to seconds?
This works:
on mouseUp
put "March 14, 1970" into tDate
convert tDate to seconds
put tDate
end mouseUp
but this doesn't work:
on mouseUp
put "March 14, 1961" into tDate
convert tDate to seconds
put tDate
end mouseUp
What am I missing?

That is because it uses the Unix Time Stamp. The Unix Time Stamp counts up every second, since the 1st of January 1970. So, dates before 1970 can't be displayed. On this website, you can get the live Unix Time Stamp and learn more about it: https://www.unixtimestamp.com/
Regards

Related

how to get a week's date with autohotkey

i'm using autohotkey to work with date, i need to catch the day a week ago
example
if today is the 28th then I have to take the 21st of last week
calendar
in the following script I take the current date
FormatTime, date, , dd/MM/yyyy
MsgBox %date%
I even thought of a logic, to take the current day subtract by 7 that will take the day a week ago. I need help to create a better script
28 - 7 = 21
if anyone can help me thanks :)
Just subtracting numbers would be bad when you encountered a change between months.
Would have to create custom logic for that.
Luckily AutoHotkey's += operator supports date/time math.
So this is all you need:
;we're starting off the date1 variable as blank,
;which means the current time will be used.
date1 += -7, days
FormatTime, finalDate, % date1, dd/MM/yyyy ;format the result to our desired format
MsgBox, % finalDate
I did it that way
FormatTime, date_, , dd
sub += date_-7
FormatTime date, , /MM/yyyy
MsgBox,%sub%%date%

How to convert a string date format `October 18th 2019` into a valid date `2019-10-17T23:00:00.000Z`

I need to convert a string date format like this October 18th 2019 ('MMMM Do YYYY') into a valid date 2019-10-17T23:00:00.000Z or similar 17/10/2019
i have tried using parsing the string into moment but i keep getting errors
update: I used moment('October 18th 2019').format(). received invalid date as the error, sorry I should clarify i'm trying to convert the string October 18th 2019 into a valid date format,
You simply need to supply the format string for the input (MMMM Do YYYY) when constructing the Moment object, with one of the following approaches:
// this way interprets the input at the start of the day in the local time zone
moment('October 18th 2019', 'MMMM Do YYYY')
// this way interprets the input at the start of the day in UTC
moment.utc('October 18th 2019', 'MMMM Do YYYY')
// this way interprets the input at the start of the day in a specific named time zone
// (requires the moment-timezone add-on)
moment.tz('October 18th 2019', 'MMMM Do YYYY', 'Europe/London')
Then you can format and/or convert it however desired. For example:
// this way keeps the local time, includes the local time offset when formatting
moment('October 18th 2019', 'MMMM Do YYYY').format()
// this way converts from local to utc before formatting
moment('October 18th 2019', 'MMMM Do YYYY').utc().format()
// this way converts from local to utc before formatting and includes milliseconds
moment('October 18th 2019', 'MMMM Do YYYY').toISOString()

How to print current Time and Date in Q Basic?

What is the command for displaying the time and date in qbasic? Could the syntax for the commands be given as well? And an explanation if possible?
You can use DATE$ and TIME$
These can also set the date and time as well.
The command for printing the time(current system time) is time$
The time$ is actually a function, in this case, no parameter is needed.
And the code is...
PRINT TIME$
The time is printed in hh: mm: ss format(hour: minutes: seconds).
And therefore the output would be something like this:
14:55:28
For printing the current system date, we use date$ function which is also a string function
The code is:
PRINT DATE$
The date is printed in mm-dd-yyyy format or month-day-year(American date format).
Hence the output will be:
02-17-2018
Hope it helps...
The QB date/time functions are:
DATE$ returns the date in a string in the form MM-DD-YYYY
TIME$ returns the time in a string in the form HH:MM:SS
When used as a command the date$ and time$ can be assigned to set the system date and time, for example DATE$ = "12-10-1990" or TIME$ = "12:10:10"
If the year is a leap year then the 29th day of February could be set. Otherwise if it is not a leap year then a syntax error will occur trying to set the date in February to the 29th.

Showing a timestamp from a datetimestamp as either AM or PM

I have a number of date/time entries in a spreadsheet which I wish to reformat as follows
10/20/2014 13:00:00 (mm/dd/yyyy hh:mm:ss) to show as 20/10/2014 PM
10/01/2014 08:00:00 (mm/dd/yyyy hh:mm:ss) to show as 01/10/2014 AM
I can convert and split the date out easily enough but I cannot get the hh:mm:ss to show as simply AM or PM.
Thanks
Under Format Cells, choose the Number tab, select Custom, and enter this format:
dd/mm/yyyy AM/PM
You can also do this using the TEXT function:
=TEXT(Date,"dd/mm/yyyy AM/PM")

Extract day of week, day, month in string from JSON

I have a problem with the formatting of dates and I gently ask your help
I have a set of data in Json format including a date in the format listed below, example:
DateEvent ":" 02/24/2012 00:00:00 "
From this date I extract format string, locating the language, the following values​​:
Day of week: Friday (Italian)
Day: 24
Month: January (Italian)
Can anyone help me?
Use a NSDateFormatter to translate the string to a NSDate object. Then use NSDateComponents with that date to get the values you want.